How to find your Linux System and Hardware Details by Command-line

In this guide, we will dig deep into the commands used to fish out these system details including the software and hardware info using uname command-line tool.

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.

uname usage
uname usage

Operating System, Hostname, and Linux Kernel

-o or –operating-system option displays the Operating System.

uname -o

Sample Output:

[email protected]:~$ uname -o
GNU/Linux

-n or –nodename option displays the hostname.

Sample Output:

[email protected]:~$ uname -n
foss-linux

For finding the Linux Kernel release, use -r or –kernel-release option.

uname -r

Sample Output:

[email protected]:~$ uname -r
5.0.0-050000-generic

-v or –kernel-version option prints the kernel version.

uname -v

Sample Output:

[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

Sample Output:

[email protected]:~$ uname --machine
x86_64

-p, –processor displays the processor type

Sample Output:

[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.

uname -a

Sample Output:

[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

Display System Software Details
Display System Software Details

Finally, in order to know the uname utility version, use –version.

uname utility version details
uname utility version details

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.

lshw command usage
lshw command usage

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.

lshw exported harware details in html format
lshw exported hardware details in HTML format

Conclusion

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.

Kiran Kumar
Hi there! I'm Kiran Kumar, founder of FOSSLinux.com. I'm an avid Linux lover and enjoy hands-on with new promising distros. Currently, I'm using Ubuntu as a daily driver and run several other distros such as Fedora, Solus, Manjaro, Debian, and some new ones on my test PC and virtual machines. I have a day job as an Engineer, and this website is one of my favorite past time activities especially during Winter ;). When I'm not writing for FOSSLinux, I'm seen biking and hiking on scenic trails. Hope you enjoy using this website as much as I do writing for it. Feedback from readers is something that inspires me to do more, and spread Linux love!. If you find a time, drop me an email or feedback from the 'Contact' page. Or simply leave a comment below if you found this article useful. Have a good day!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

STAY CONNECTED

24,726FansLike
164FollowersFollow

LATEST ARTICLES