Getting hardware and your Linux system software details are one of the important steps in Linux administration. In this article, we will dig deep into the commands used to fish out these system details using uname command-line tool. Additionally, we will use the lshw command to get more detailed information about hardware.
Since the commands are native to Linux, these should work on any Linux distro Terminal. Note that all the below commands are to be entered in the Linux Terminal.
Finding Software & Hardware Details
To begin with, let’s first find out the software details including Linux Kernel, Distro, and other such details. The command used to find the system information is uname. The general syntax is as follows:
1. uname command
Usage: uname [option]
We shall discuss all the options and of the uname command with sample output from our test PC. uname –help command in your Terminal provides all the details of how the command can be used.
Operating System, Hostname, and Linux Kernel
-o or –operating-system option displays the Operating System.
[email protected]:~$ uname -o GNU/Linux
-n or –nodename option displays the hostname.
[email protected]:~$ uname -n foss-linux
For finding the Linux Kernel release, use -r or –kernel-release option.
[email protected]:~$ uname -r 5.0.0-050000-generic
-v or –kernel-version option prints the kernel version.
[email protected]:~$ uname -v #201903032031 SMP Mon Mar 4 01:33:18 UTC 2019
Processor, Machine Type, Hardware Platform
Moving to the hardware details, we still use the uname command with options as follows:
-m, –machine displays the machine hardware name
[email protected]:~$ uname --machine x86_64
-p, –processor displays the processor type
[email protected]:~$ uname -p x86_64
-i, –hardware-platform displays the hardware platform
[email protected]:~$ uname -i x86_64
If you want all the above information in a single command, use -a or –all option as follows.
[email protected]:~$ uname -a Linux foss-linux 5.0.0-050000-generic #201903032031 SMP Mon Mar 4 01:33:18 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Finally, in order to know the uname utility version, use –version.
2. lshw command
List Hardware (lshw) command is another popular command used by the system administrators to get very detailed information of the hardware specs of the machine. It does so by reading different files in the /proc directory in the Linux machine.
The lshw utility needs root access to get the information. It can report RAM configuration, Firmware version, Motherboard configuration, CPU info, cache configuration, bus speed, etc. It comes installed by default in most of the Linux distros. If the below commands don’t work, your Linux distro does have it installed. Head over to the official Github page to install the utility.
The command syntax is lshw [-format] [-options …]
The format can be any one of the following:
html output hardware tree as HTML
-xml output hardware tree as XML
-json output hardware tree as a JSON object
-short output hardware paths
-businfo output bus information
Options can be any one of the following:
-class CLASS only show a certain class of hardware
-C CLASS same as ‘-class CLASS’
-c CLASS same as ‘-class CLASS’
-disable TEST disable a test (like pci, isapnp, cpuid, etc. )
-enable TEST enable a test (like pci, isapnp, cpuid, etc. )
-quiet don’t display the status
-sanitize remove sensitive information like serial numbers, etc.
-numeric output numeric IDs (for PCI, USB, etc.)
-notime exclude volatile attributes (timestamps) from output
Since it needs to run as root, use sudo before the command:
Example: sudo lshw will list all the details of the machine.
The best part of the lshw command is how it can export the output to html format so that you can easily share with others or save it for the record.
Usage: sudo lshw -html > [filename.html]
Example: sudo lshw -html > hardware_details.html
The html file should get saved in the Home directory.
Hope you enjoyed reading this tutorial to find your Linux machine’s software and hardware details. Uname is a simple tool that doesn’t need root access and can get basic details. For complete details, deep diggers can use the powerful lshw command with root privileges.