Once the Linux kernel initializes, it enumerates all hardware components. There are plenty of commands to check information about the hardware of a Linux system. Some commands report only specific hardware components like CPU or memory while the rest cover multiple hardware units.
1. Printing Machine Hardware Name (uname –m uname –a)
Using the -m switch with the uname command prints the hardware name of our machine. If we want the uname command to print all the information mentioned above, we can use the command with all the switches.
The lscpu command reports information about the cpu and processing units. It does not have any further options or functionality.
lshw –List Hardware
A general purpose utility, that reports detailed and brief information about multiple different hardware units such as cpu, memory, disk, usb controllers, network adapters etc. Lshw extracts the information from different /proc files. Lshw is capable of reporting memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed etc. The lshw command needs to run with super privileges to be able to detect and report the maximum amount of information. So run as root, or use sudo. Lshw assorts hardware components into groups called “class”. Processor, memory, display, network, storage are all different classes.
$ sudo lshw $ sudo lshw –short
Generate report in html/xml format
We can also export lshw reports in html, xml and json formats.
$ sudo lshw –html > lshw-output.html
$ sudo lshw –xml >lshw-output.xml
2. hwinfo- Hardware Information
Hwinfo is another general purpose hardware probing utility that can report detailed and brief information about multiple different hardware components, and more than what lshw can report.