Linux systems have several hardware components, and it is important to know the exact hardware specifications to know whether your Linux computer is compatible with certain applications. Linux supports multiple commands or tools to check hardware devices, such as CPU, memory, PCI card, USB devices, and network card. Some of these commands are lshw, lscpu, hwinfo and lspci.
In this tutorial, we cover some of the most significant Linux commands to check hardware device information on your computer.
Hardware Overview Using inxi
The inxi mega bash script is an extremely useful and powerful Linux command-line tool that displays Linux hardware information on your computer. It generates a neatly formatted report that you can easily read and understand the hardware information.
The inxi system information report includes information such as CPU, RAM, hard drive, graphic cards, network cards, sound cards, Linux Kernel, and uptime. This command can be used on both command line and Internet Relay Chat (IRC).
When you use this command without any options, then it displays only basic hardware information:
To display more hardware details, use it with the -Fx option.
List Hardware Using lshw
The lshw utility reports critical information about multiple hardware components, such as CPU, hard disk, memory, disk controllers, network adapters, and USB controllers. This command retrieves Linux hardware information from various /proc files.
Lshw reports CPU version and speed, memory configuration, motherboard configuration, firmware version, and bus speed. You should run this as either the root user or a user with sudo privileges to display correct information.
By default, when run without any options, lshw reports detailed information. Use the -short option to generate a brief report:
sudo lshw -short
Linux Hardware Information Using hwinfo
Hwinfo is another useful Linux command-line utility to display both detailed and brief information and generate Linux hardware information reports. It provides more hardware details than lshw and can be useful in troubleshooting hardware components.
Hwinfo is a hardware analysis, reporting, and monitoring tool that performs in-depth real-time hardware monitoring reports. This tool scans all hardware components of your system, operating system, memory, and storage capacity. The hwinfo command also provides advanced information.
Hwinfo is not pre-installed on most Linux distros, so you must first install it before generating the hardware report. When used without any options, it generates a lengthy report. Use the --short option to generate a brief report:
Linux CPU Information Using lscpu
Use the lscpu command to generate detailed report about CPU and processing units on your Linux system. The lscpu command provides information about CPUs architecture, CPU cores, caches, and model. It retrives information from /proc/cpuinfo and sysfs.
The lscpu command also provides Linux CPU information about ventilation features and other capabilities supported by your CPU. This command does not provide options to shorten your report, so the default report will look like this:
Alternatively, you can use the -c cpu option with the lshw command to retrieve Linux CPU information:
lshw -C cpu
CPU-X is an open-source and free system monitoring and profiling tool designed for the Linux operating system. It is built with CMake tool and written in C language. CPU-X can be used in both graphical mode and text-based mode.
CPU-X reports hardware component and system information about processor, caches, motherboard, memory, graphics, bench, and system. Run the following command to display hardware and system details in the graphical mode.
Memory Information Using dmidecode
The dmidecode utility retrieves Linux hardware information from the SMBIOS data structures, also known as DMI tables. Use dmidecode to check the number of memory slots and amount of RAM in every slot.
To print memory information using the dmidecode command, use the -t memory option:
sudo dmidecode -t memory
Alternatively, you can use the -short -C memory options with the lshw command to display memory information:
lshw -short -C memory
You can also use the top command and press m key to sort the information by memory usage.
Disks Information Using hdparm
Use the hdparm utility to display information about the SATA devices on your Linux system. Every command has different way of extracting information and may display different information. You may need to try different command to display only specific hardware components.
Most Linux distros have this command utility pre-installed, but you can install hdparm from the default repository. The following hdparm command displays information about the hard drive:
sudo hdparm -i /dev/sda
Alternatively, you can use the -short -C disk option with the lshw command to display memory disk information:
lshw -short -C disk
The fdisk command can also be used to display all disk partition of your Linux hard disk:
To display detailed block device information on your Linux system with size, type, and mount point, use the following command:
Use the lsusb command to list all USB controllers on your Linux system. By default, this command shows brief information. To provide detailed information, use the -v option with the lsusb command for the verbose output about USB ports.
The following lsusb command prints detailed USB controllers information that are active on your current computer, irrespective of the device connection on the USB ports:
To list all network adapters or display information about the network card on your Linux system, use the lshw command with the network option. The network adapter version or model information is helpful for upgrading your network or Internet connection.
The network hardware information command displays information about both ethernet wired connection and the wireless interface. Additionally, the network connection hardware details are also displayed in the output.
lshw -C network
Alternatively, you can also use the ip link show command to display network card information, such as name, MTU, status, and other details.
Your Linux computer has multiple PCI buses that are used for different connections. Use the lspci command to list all the PCI buses and all the devices that are connected to these buses. This command shows buses such as network adapters, SATA controllers, USB controllers, graphics cards, and VGA adaptors.
The default output of the lspci command shows only the brief information in a list format. You can use the -v option to provide detailed information about the PCI devices. The default output looks like this:
Use the lsscsi command to list all SCSI and SATA devices, such as hard drives and optical drives connected on your Linux computer. You may not always have SCSI and SATA device connecters installed on your computer, but if you have, the command will show them.
By default, the lsscsi command displays only the brief information about the SCSI and SATA devices. Use the -v option to print detailed information about the SCSI and SATA connectors and connected devices:
Video Card Memory
Use the lspci command to display the VGA PCI bus data. VGA adaptor is also a PCI bus that is displayed in the PCI bus list. However, the default output does not show any useful details except for the controller type and ID:
To display further details about the VGA controller, use the -s option with the PCI bus ID:
lspci -v -s 00:02.0
Linux System Information
The Linux hardware information commands mostly display information about the hardware components, such as CPU, RAM, GPU, network cards, and USB controllers. To display system information, use the following commands:
The uname command with -a option displays operating system name, version, and architecture information:
To display memory information on your system, including the total disk space, used disk space, and free disk space, use the free command:
The neofetch utility creates a neat report of the system data, such as OS, Kernel version, CPU, and memory:
Check the contents of the /etc/os-release file to know the OS version, name, and other system information:
dmidecode -t bios
Use the dmidecode command to display BIOS information using the -t bios option:
In this tutorial, we learned how to display hardware and system information in Linux using different commands. Some of the commands display all system information, but some commands can display information about only specific hardware components, such as CPU, USB, network controllers, and USB. Try these command examples to display specific information about the hardware and system components on your Linux computer.