The commands mentioned in this article have been run on a Debian 10 Buster system but they can be replicated easily on most Linux distros.
We will be using the Debian command line, the Terminal, to fetch all the hardware information. You can open the Terminal application by entering the keywords ‘Terminal’ in the Application Launcher search as follows:
Use the Super/Windows key to access the Application Launcher.
Fetching Basic System Information through the Uname Command
The uname command, short for unix name, in Linux is used to print operating system and hardware information through the command line. Here is the syntax of the uname command:
By using various option switches with the command, you can choose to print either all or some specific information about your system.
The default behavior of the uname command
When you use the uname command without any switch, it prints the Linux Kernel name running on your system. Here is how you would use the command:
You can see how the uname command prints my Kernel name, which is Linux.
Printing Kernel Name through uname
Now, if you particularly want the uname command to print the Kernel name, you can use the -s switch with the command as follows:
We need to use the -s option in the scenario where we want to print the Kernel name along with some other information by using more than one switch.
Printing Kernel Release through uname
If you want the uname command to print the Kernel release you are using, you can use the -r switch with the command as follows:
You can see how the output prints the release number of the Linux kernel I am running.
Printing Kernel Version through uname
If you want the uname command to print the Kernel version you are using, you can use the v switch with the command as follows:
You can see how the output prints the version number of the Linux kernel I am running.
Printing Machine Hardware Name through uname
Using the -m switch with the uname command prints the hardware name of your machine.
This lets you know the hardware architecture of your system.
If you see x86_64 as the output, you are using a 64-bit machine. The output i686 indicates that you are using a 32-bit architecture.
Printing Network Node Hostname through uname
Using the -n switch with the uname command prints the node name/hostname of your system. The hostname is the identification that a system uses to communicate on a network.
The output of the uname command with the -n switch is the same as that of the ‘hostname’ command.
Printing Processor Type through uname
You can use the uname command as follows with the -p switch in order to print the processor type:
The above command did not produce a valid output on my Debian but it gives accurate information on Ubuntu.
Printing Hardware Platform through uname
The uname command with the -i switch is used to print the hardware platform you are on.
The above command also did not produce a valid output on my Debian but it gives accurate information on Ubuntu.
Printing Operating System name through uname
The uname command with the -o switch prints the operating system name that you are running.
The output of this command is GNU/Linux on all Linux distros.
Printing All the above information through uname
If you want the uname command to print all the information mentioned above, you can of course use the command with all the switches. The simple way, however, is to use only the -a switch with the uname command as follows:
You can see how the output displays all the information we have printed above, one by one.
Fetch Detailed Hardware Information
In this section, we will explain some more commands through which you can print a complete picture of your hardware specifications and also that of some individual hardware components.
Fetching Hardware Picture through the lshw command
Lshw, short for list hardware, is a command line utility that is used to print information about the hardware components of your system. It fetches information like CPU type & speed, disks, memory, bus speed, firmware, cache, etc, from the /proc files. If your system does not have this utility installed by default, you can install it through the following command as an administrator:
You can then fetch a detailed hardware report through the following command:
Running the command as sudo gives you access to the confidential information about the system.
If you are looking for a summary of the above information, you can get it through the following lshw usage:
You can see how the command prints a better readable hardware profile in a column-wise format.
You can print the output of the lshw command to an html file for sharing or for later use.
Run the following command as sudo in order to do so:
The html is saved in the current user’s home folder by default and this is how it looks like:
Fetching CPU Information through lscpu
The lscpu command fetches detailed CPU information from the /proc/cpuinfo and sysfs files. This is the exact command you will be using:
Fetching Block Device Information through lsblk
The lsblk command fetches detailed block device information such as your hard drives, flash drives, and their partitions. This is the exact command you will be using:
For even more information, you can use the following command:
Fetching USB Controllers Information through lsusb
The lsusb command fetches and prints detailed USB controllers information along with the connected hardware. This is the exact command you will be using:
For even more information, you can use the following command:
Here are some of the other commands you can use to get information about a particular kind of device:
Command | Information |
$ lspci | Fetch information about PCI devices connected to your system |
$ lsscsi | Fetch information about SCSI devices connected to your system |
$ hdparm [device_location] | Fetch information about SATA devices connected to your system. For example, use the command $ hdparm /dev/sda1 for information about sda 1 |
This was all you needed to know about printing all or specific system and hardware information on your Linux.