Demo image Demo image Demo image Demo image Demo image Demo image

Find your hardware specifications in Linux

  • Thursday, September 16, 2010
  • zana991
  • Easily find your hardware specifications (and some system monitoring commands) in Linux


    When a PC or server is running Linux, you often want to know exactly what sort of hardware is actually running inside the box and more importantly whether it is supported by the kernel. Here is a list of commands which should help you to learn about your system and some of its specifications. In some cases, these commands may not work as listed below if you’re running a Red Hat or Fedora based distribution. In those instances simply specify the path to the command which will be /sbin/command.

    If any of the output runs off your screen, just add |more to the end of any of these commands to see the output one screen at a time and hit the spacebar to go to the next screen, or Q to quit.

    Processor type:
    $ cat /proc/cpuinfo

    Is the processor using 32 or 64 bit instruction set:
    $ cat /proc/cpuinfo | grep flags | grep lm
    If you get some output you have a 64 bit CPU. If you receive no output, then you’re using a 32 or even 16 bit CPU. The reason this is the case is that the CPU yields many flags that tell Linux what sort of processor it is, and the lm flag informs Linux that the CPU is a 64 bit processor. Grep as a command filters output. Feel free to run this command without the grep suffixes (cat /proc/cpuinfo) to see the full output of your CPU details.

    What hardware (audio, video, disk controllers, etc) is in my Linux box:
    $ lspci -tv
    (The -t switch groups similar devices together for easy reading and -v offers more verbosity.)

    To easily filter out the above command to just show graphic card information:
    $ lspci | grep VGA

    What USB devices are plugged in:
    $ lsusb

    Check the size of the hard drive and what hard drives are available in the system.
    This command will also list USB drives and sticks. You need a root permissions to execute the fdisk command:
    $ sudo fdisk -l | grep GB

    Show info about a particular hard disk including firmware revision (replace sda with the appropriate drive as listed from the above command):
    Note: This will only work on internal disks, NOT USB drives.
    $ sudo hdparm -i /dev/sda

    Check what partitions and file system is in use on my hard drives (same as the above command, but essentially more verbose):
    $ sudo fdisk -l

    Locate CD/DVD-ROM device file which offers a CD/DVD-ROM’s make and model info:
    $ wodim –devices
    or
    $ wodim –scanbus
    The above command will scan your entire system bus for attached devices (this won’t include USB Devices as they are not direct-bus-attached devices).

    What modules are currently loaded:
    $ lsmod

    get a information about any particular module:
    $ modinfo module_name

    remove modules:
    $ modprobe –remove module_name

    load a modules to the kernel:
    $ modprobe module_name

    What hardware is using which module.
    The -v switch is for vebosity, where -vvv is EXTRA verbosity.
    $ lspci -v
    or
    $ lspci -vvv

    Check for PCMCIA cards:
    $ lspcmcia

    How much RAM is installed in my Linux and how much of it is in use (megabytes).
    It will also include swap memory:
    $ free -m
    There is a gigabyte switch, but it *rounds* it down, so it isn’t very accurate for RAM info:
    $ free -g

    Check sound card settings. This command will reveal whether your sound card is installed and what modules are in use:
    $ cat /dev/sndstat

    Available wireless cards:
    $ iwconfig

    What speed is set to FANs:
    $ cat /proc/acpi/ibm/fan
    If this command doesn’t work, then feel free to peruse the /proc/acpi directory on your system. You will find info available on your CPU, AC Adapter, Battery, etc. Some info is available here, and your mileage may vary for viewing any of the files in /proc/acpi.

    Get a battery information on your laptop (assuming it’s been installed):
    $ powersave -b

    To find out what Linux Kernel you’r running:
    $ uname -a

    To find out what distribution of Linux you’re running:
    Run any of these commands, as depending on your distribution some may or may not work.
    $ cat /etc/issue
    $ cat /proc/version
    $ dmesg | head -1

    Get a recent history of system reboots:
    $ last reboot

    To open any file from command line using the default application (will launch the correct graphical application for the file, as though you had doubled-clicked the file graphically):
    $ xdg-open ./filename

    To monitor all active network connections, and update live every second:
    $ watch -n.1 ‘netstat -tup’

    To passively list all connections, active or inactive:
    $ ‘netstat -tupl

    0 comments: