Getting to know the hardware of your Linux box

When you buy a new PC, laptop, or server and install a Linux distribution, you want to know what hardware is actually installed in the Linux box and more importantly which piece of hardware is supported by the kernel out of the box and which needs special tweaking with modules to get it to work.

This guide features a list of command line examples which should help you to troubleshoot your hardware and find some information about it. This is not an ultimate troubleshooting guide but certainly will serve as a good starting point. Note that some commands may not be available for your platform by default, and some commands may be specific to certain distributions.

In this tutorial you will learn:

  • How to see what hardware is installed via Linux commands

Getting to know the hardware of your Linux box

Getting to know the hardware of your Linux box

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

What hardware is in my Linux box



  1. See general information about host bridge, VGA controller, ethernet controller, USB controller, SATA controller, and more.
    # lspci
    
  2. See some information about BIOS, motherboard, chassis, and more.
    # dmidecode
    

Processor information

  1. Retrieve processor type, socket, speed, configured flags, and other information.
    # cat /proc/cpuinfo
    
  2. Use the x86info utility to see information about the CPU.
    # x86info
    

    Or for more details:

    # x86info -a
    

Also see our guide on how to obtain CPU information on Linux.

Memory (RAM) information

  1. See how much RAM is installed on a Linux box and how much of it is in use (in megabytes). This will also include swap memory.
    # free -m
    
  2. You can also use the top or htop commands to see RAM and its current usage.
    # top
    or
    # htop
    


  3. See detailed information about system RAM.
    # cat /proc/meminfo
    
  4. Detect number of RAM slots used, speed, and size.
    # lshw -C memory -short
    

Also check out our guide on how to monitor RAM usage on Linux.

Retrieving memory and CPU info with Linux commands

Retrieving memory and CPU info with Linux commands

What hardware is using which module

  1. Adding the -v (verbose) flag to the lspsci command will show more detailed information about installed hardware controllers and their corresponding modules.
    # lspci -v
    
  2. You can also add three verbose flags with -vvv to see information that is even more detailed.
    # lspci -vvv
    
  3. If you have hardinfo installed on your system, use the following command to open a GUI program, click on the “kernel information” tab and see what modules each piece of hardware is using.
    # hardinfo
    
  4. List all hardware components and see their configuration details.
    # lshw
    
  5. Use the GUI version of lshw with the lshw-gtk command.
    # lshw-gtk
    
  6. List details for all hardware, including their device files and configuration options with the hwinfo command, which may or may not be installed by default on your distro.
    # hwinfo
    


BIOS information

  1. Get some general information about your system’s BIOS.
    # biosdecode
    
  2. Retrieve the name of your BIOS vendor with this simple command.
    # dmidecode -s bios-vendor
    

Motherboard and additional components

  1. Retrieve information about your system’s motherboard, including make, model, serial number, and more.
    # dmidecode --type baseboard
    
  2. Get a list of USB devices plugged into your system.
    # lsusb
    


  3. Retrieve a list of USB device files.
    # ls -la /dev/disk/by-id/usb-*
    
  4. Retrieve information about the installed video card.
    # lspci | grep VGA
    

Hard drive information

  1. Get information about your hard drive’s make, model, serial number, firmware version, and configuration (replace the x with the actual name of your hard drive, such as /dev/sda).
    # hdparm -I /dev/sdx
    
  2. Show the speed of an installed hard drive – including cached reads and buffered disk reads.
    # hdparm -tT /dev/sdx
    
  3. 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.
    # fdisk -l | grep GiB
    
  4. Check what partitions and file system is in use on my hard drives.
    # fdisk -l
    

See also how to check disk usage by folder and how to check disk space with df and du commands.

CD/DVD-ROM information

  1. Locate CD or DVD device file.
    # wodim --devices
    


  2. Alternatively you may try the --scanbus option.
    # wodim --scanbus
    

List, load, and remove modules

  1. Find what modules are currently loaded.
    # lsmod
    
  2. Get information about any particular module.
    # modinfo module_name
    
  3. Remove a module.
    # modprobe --remove module_name
    
  4. Load a module into the kernel.
    # modprobe module_name
    

Other cards and devices

  1. Check for PCMCIA cards installed in the system.
    # lspcmcia
    
  2. Check sound card settings. This command will reveal whether your sound card is installed and what modules are in use.
    # cat /dev/sndstat
    


  3. Check available wireless cards.
    # iwconfig
    
  4. See what speed the fans are set to. This may not work on some systems.
    # cat /proc/acpi/ibm/fan
    
  5. Get battery information on your laptop. You may need to install the pm-utils package before using.
    # pm-powersave -b
    
  6. List Plug and Play BIOS devices.
    # lspnp
    

Closing Thoughts

In this guide, we saw various Linux commands that can be used to check the installed hardware in a computer. These commands should help you get to know your hardware without forcing you to crack open the PC and examining individual components. This ends up saving a lot of times and gives us a concise output of what hardware is installed in our system.



Comments and Discussions
Linux Forum