When using Linux it may be necessary to know the system you are on or the hardware specifications you are using. As a normal Linux user or software developer, it is important that you verify the compatibility of any software or hardware system that you are about to install. The Linux command line has several built-in commands that you can use to familiarize yourself with the software and hardware platform on which you are working. This tutorial provides you with the use of all of these commands.
We ran the commands and examples mentioned in this tutorial on a Debian 10 Buster system.
View basic system information about Debian 10
To know basic information about your system, you need to be familiar with the command line utility called uname-short for Unix names.
The uname command
The uname command contains several switches. The basic command described below only returns the kernel name:
As you can see, the uname command, when used without a switch, only returns the kernel name, i.e. Linux for my system.
If you want the command to print the kernel name, use the following command:
$ uname -s
The above output showed Linux as my kernel name.
To print out the release notes for your kernel, use the following command:
$ uname -r
The above command showed the version number of my Linux
To get the version of your kernel use the following command:
$ uname -v
The above output shows the version number of my kernel.
Host name of the network node
You can use the following command to print the network host name 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 show the same output above. Please note that the host name and the node name may not be the same for non-Linux systems.
Name of the machine hardware
To know the hardware architecture of the system you are working on, please use the following command:
$ uname --m
The output x86_64 means that I am using a 64-bit architecture. The output of i686 would mean that a user is on a 32-bit system.
To find out the type of processor you are using, please use the following command:
$ uname -p
Even though I’m using a 64-bit processor, the command was unable to get this information.
To find out which hardware platform you are using, please use the following command:
$ uname -i
The following command tells you the name of the operating system used:
$ uname -o
My Debian machine showed the above output for my system.
View all system information
The above commands have displayed system information depending on the type of switch used. If you want to see all system information at once, use the following command:
$ uname -a
You can see the output above shows the full list of system information for the user.
View detailed hardware information
Here we describe the commands other than uname that are used to extract detailed hardware information of your system:
Display hardware information
The lshw utility can be used to get critical hardware information like memory, CPU, hard drives, etc. from your system. Run the following command as superuser to view this information:
$ sudo lshw
If the command is not installed on your system, you can install it using the following command:
$ sudo apt-get install lshw
The output above is a very detailed version of my system’s hardware information. You can also view a summary of the hardware information as described in the following section.
Show the hardware overview
To view the summary of your detailed hardware profile, please use the following command:
$ lshw -short
The output above is a column-by-column summary of the hardware profile that is easier to read.
Create an HTML file with hardware details of your computer
As a superuser, you can also use the lshw utility to print your hardware profile to an HTML file. To do this, use the following command:
$ sudo lshw -html> [filename.html]
$ sudo lshw -html > hardwareinfo.html
The above HTML file was created in the / home / user / folder.
CPU information with lscpu. recall
The lscpu utility lists detailed CPU information from the sysfs and / proc / cpuinfo files on your screen. Here’s how you can use this command:
The above output shows 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 of the basic storage devices on your system, such as: B. the hard drive, its partitions and the flash drives connected to your system.
You can view much more detailed information about all devices with the following command:
$ lsblk -a
Information on USB controllers
The lsusb lists information about all USB controllers and the devices connected to them. Please run the following command:
You can also use the following command to view detailed information about each USB device
$ lsusb -v
This output shows all USB controllers and the connected devices.
Information about other devices
You can also view information about the following devices in your system:
- PCI devices
Command: $ lspci
- SCSI devices
Command: $ lsscsi
- SATA devices
Command: $ hdparm [devicelocation] e.g. $ hdparm / dev / sda2
After you have practiced with this tutorial, you will find yourself coming back over and over again to learn about Linux and the underlying hardware of your system. This will help you review the system specifications and verify that any potential hardware or software is compatible with your system.