How to Get Hardware Info on Linux?

Getting hardware information in other operating systems, such as Windows is easy. However, users find it complicated due to the command line interface regarding Linux or Unix-based operating systems. There are multiple commands for checking the hardware information in the Linux operating system, such as “hwinfo”, “lscpu”, uname, etc.

This article demonstrates various command line utilities and a GUI method to get hardware information on Linux.

General Hardware Information Through hwinfo Command

The “hwinfo” is the most frequently used command for displaying the hardware information of the operating system. The “hwinfo” command can be installed using the below command:

$ sudo apt install hwinfo          #Debian/Ubuntu
$ sudo yum install hwinfo          #CentOS/RHEL
$ sudo dnf install hwinfo          #Fedora

To display the short description of all the hardware in the operating system use the following command:

$ hwinfo --short

The hardware information of the devices, such as “network”, “disk”, etc., are displayed.

For more options to use the “hwinfo” command, check out our latest article on the hwinfo command.

CPU Information Through lscpu Command

The “lscpu” is the built-in utility for displaying the CPU architecture information such as vendor ID, virtualization features, etc. Run the “lscpu” command in the terminal:

$ lscpu

The CPU information will be displayed as shown in the above image.

System Information Through the uname Command

The “uname” (Unix name) is the Linux command for displaying hardware information. Various options can be considered for displaying the information.

Syntax:

$ uname [Options]

To get the Kernel name and Kernel release, simply use the “s” and “r” flags with the uname command:

$ uname -sr

The Kernel name is “Linux”, and the Kernel release is “5.15.0-58 generic”.

To display the hostname using the “uname” command, use the “n” option:

uname -n

The hostname has been printed.

To display the processor type of the operating system, use the “p” flag:

$ uname -p

The processor type has been printed.

To display all the combined information through the name command, use the “all” flag:

$ uname --all

All information has been displayed.

RAM Information Through free and top Commands

To get information about RAM, the “free” and the “top” utility can be utilized. The “free” is the built-in utility used by Linux administrators for displaying memory information. Use the “m” flag with the free command:

$ free -m

The above image shows the total used and the free memory

The “top” is the utility for displaying the Kernel-related task, but it can be used for getting information about the total memory. Run the “top” command in the terminal:

The total, used, and free memory can also be seen in the above image.

For in-depth knowledge of the top command, go to our latest article on top command.

Block Devices Information Through lsblk Command

To get the information about the block devices, use the “lsblk” command. It will display the disks with their partition in the tree format:

$ lsblk

The disks with their partitions will be displayed.

PCI Devices Information Through lspci Command

To get the PCI (Peripheral Component Interconnect) of the PC, the user can use the “lspci” command:

$ lspci

The above image shows information about PCI devices such as controllers, graphic cards, etc.

SCSI Devices Information Through lsscsi Command

The information about the SCSI (Small Computer and System Interface) is obtained as follows:

$ lsscsi

The information about the SCSI devices has been displayed.

SATA Devices Information Through inxi Command

The “inix” is the bash script that gets the hardware information from various sources and commands and displays the report that is readable for all users. Run the “inxi” with the “x” flag:

$ inxi -x

The above image shows the hardware information of the PC.

USB Devices Information through lsusb Command

To get the information about the USB devices, use the “lsusb” command in the terminal:

$ lsusb

The output contains the information about the USB devices.

Hardware Information Using hardinfo (GUI Method)

Hardware information can also be displayed using the “hardinfo” software based on the GUI method. It is the most frequently used tool for displaying the hardware information of the operating system. To install hardinfo software in Linux, use the below command:

$ sudo apt install hardinfo         #Debian/Ubuntu/Mint
$ sudo yum install hardinfo         #Fedora
$ sudo pacman -S hardinfo           #Arch/Manjaro
$ sudo zypper install hardinfo      #OpenSUSE

Once you install the hardinfo software, launch it by running the “hardinfo” command. You will see the graphical user interface has a list of the various hardware devices. Just click on the desired hardware option:

Clicking on the Processor option has revealed information about the processor like its generation, core, base frequency, etc.

Conclusion

In Linux, various commands are used for getting the hardware information, i.e., “hwinfo”, “lscpu”, “uname”, “free”, “top”, “lsblk”, lspci “lsscsi”, “inxi”, “lsusb” commands. Users can also check the hardware information using the “hardinfo” software that is GUI based. This write-up has illustrated ways to get the hardware information on Linux.