While using Linux, there might arise a need to know about the system you are on or the hardware specifications you are using. As a normal Linux user or a software developer, it is important for you to check the compatibility of a software or hardware system that you want to install. Linux command line comes with multiple built-in commands for you to get familiar with the software and hardware platform you are working on. This tutorial provides you with the usage of all these commands.
We have run the commands and examples mentioned in this tutorial on a Debian 10 Buster system.
Displaying Basic System Information on Debian 10
To know the basic information about your system, you need to be familiar with the command-line utility called uname-short for unix name.
The uname Command
The uname command comes with multiple switches. The basic command as described below only returns the Kernel name:
As you can see, the uname command when used without any switches only returns the kernel name i.e., Linux for my system.
When you precisely want the command to print the kernel name, you will use the following command:
$ uname -s
The above output has displayed Linux as my kernel name.
In order to print the release information of your kernel, use the following command:
$ uname -r
The above command has displayed the release number of my Linux
In order to fetch the version of your kernel, use the following command:
$ uname -v
The above output shows the version number of my kernel.
Network Node Hostname
You can use the following command to print the network hostname of your node:
$ uname -n
You can also use the following command for the same purpose as it is more user-friendly:
$ uname --nodename
Both commands will display the same above output. Please note that the hostname and the node name might not be the same for non-Linux systems.
Machine Hardware Name
In order to know the hardware architecture of the system you are working on, please use the following command:
$ uname --m
The output x86_64 signifies that I am using a 64-bit architecture. The output i686 would mean that a user is on a 32-bit system.
In order to know the type of processor you are using, please use the following command:
$ uname -p
Although I am using a 64-bit processor but the command failed to fetch this information.
In order to know the hardware platform you are using, please use the following command:
$ uname -i
The following command will let you know the name of the operating system you are using:
$ uname -o
My Debian machine has displayed the above output for my system.
Displaying All System Information
The above commands have displayed system information as per the type of switch used. In case, you want to see all the system information at once, use the following command:
$ uname -a
You can see that the above output shows the complete list of system information for the user.
Displaying Detailed Hardware Information
Here we will describe the commands, other than uname, that are used to extract detailed hardware information of your system:
Show Hardware Information
The lshw utility enables you to fetch important hardware information such as memory, CPU, disks, etc. from your system. Please run the following command as a super user in order to view this information:
$ sudo lshw
If the command is not installed on your system, you can install it through the following command:
$ sudo apt-get install lshw
The above output is a very detailed version of the hardware information of my system. You can also view a summary of hardware information as described in the following section.
Viewing Hardware Summary
In order to view the summary of your detailed hardware profile, please use the following command:
$ lshw -short
The above output is a column-wise summary of the hardware profile which is more readable.
Creating an HTML File with Hardware Details of your Computer
The lshw utility also lets you print your hardware profile to an html file as a super user. Use the following command for this purpose:
$ sudo lshw -html > [filename.html]
$ sudo lshw -html > hardwareinfo.html
The above html file has been created at the /home/user/ folder.
Get CPU Information with lscpu
The lscpu utility lists detailed CPU information from the files sysfs and /proc/cpuinfo to your screen. This is how you can use this command:
The above output displays CPU architecture, number of CPUs, cores, CPU family model, threads, CPU caches and much more.
Block Device Information
The lsblk utility displays information about all the basic storage devices of your system such as hard drive, its partitions and the flash drives connected to your system.
You can use the following command to view much more detailed information about all the devices:
$ lsblk -a
USB Controllers Information
The lsusb lists information about all the USB controllers and the devices connected to them. Please run the following command:
You can also use the following command to view a much detailed information about each USB device
$ lsusb -v
This output displays all the USB controllers and the attached devices.
Information About Other Devices
You can also view information about the following devices of your system:
Command: $ lspci
Command: $ lsscsi
Command: $ hdparm [devicelocation] e.g. $ hdparm /dev/sda2
After practicing along with this tutorial, you will never fail to retrieve information about the Linux and the underlying hardware of your system. This will help you check the system specifications and whether or not a prospective hardware or software is compatible with your system.