If you are using Linux, you may need to know details about the system you are using or the hardware specifications you are using. As a regular Linux user or software developer, it is important that you check the compatibility of any software or hardware system that you want to install. The Linux command line contains several built-in commands that help you become familiar with the software and hardware platform you are working on. In this tutorial, you will learn how to use all of these commands to get the sysinfo Linux details.
The commands and examples in this tutorial have been tested on Ubuntu 18.04 to Ubuntu 22.04 and Debian 11.
Displaying Basic System Information on Linux Shell
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.
Get the Linux Kernel Name
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.
Get the Linux Kernel Release
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
Get the Linux Kernel Version
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.
Get 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 output. Please note that the hostname and the node name might not be the same for non-Linux systems.
Get Machine Hardware Architecture (i386, x86_64, sysinfo Linux)
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 means that a user is on a 32-bit system.
Get Processor Type
In order to know the type of processor you are using, please use the following command:
$ uname -p
This output shows that I am using a 64-bit processor.
Get Hardware Platform
In order to know the hardware platform you are using, please use the following command:
$ uname -i
In my case, the output is the same as that of the machine hardware name.
Get Operating System information
The following command will let you know the name of the operating system you are using:
$ uname -o
My Ubuntu machine has displayed the above output for my system.
Displaying All Information of Uname Command
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:
Get Hardware Information with lshw
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
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.
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
The lshw utility also lets you print your hardware profile to an HTML file as a superuser. 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.
Get Block Device Information with lsblk
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
Get USB Device Information with lsusb
The lsusb command 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 much detailed information about each USB device.
$ lsusb -v
This output displays all the USB controllers and the attached devices.
Get Information About Other Devices
You can also view information about the following devices of your system:
- PCI devices
Command: $ lspci
- SCSI devices
Command: $ lsscsi
- SATA devices
$ hdparm [devicelocation] e.g. $ hdparm /dev/sda2
After practicing along with this tutorial, you will never fail to retrieve sysinfo about Linux and the underlying hardware of your system. This will help you check the system specifications and whether or not prospective hardware or software is compatible with your system.