How to view detailed Linux system and hardware information on the command line
When using Linux, you may need to know details about the system you are running or the hardware specifications you are using. As a normal Linux user or software developer, it is important that you check the compatibility of the software or hardware system you want to install.
When using Linux, you may need to know details about the system you are running or the hardware specifications you are using. As a normal Linux user or software developer, it is important that you check the compatibility of the software or hardware system you want to install. The Linux command line contains a number of built-in commands to help you become familiar with the software platform and hardware you will be working on. The following tutorial will teach you how to use all these commands.
Displays basic system information on Linux Shell
For basic information about the system, you need to be familiar with the command line utility called uname - short for unix name.
uname command
The uname command comes with many switches. The basic command as described below returns only the Kernel name:
$unname
Output:
As you can see, the uname command when used without any switches returns only the kernel name.
See Linux kernel name
When you want to know the exact command to output the kernel name, you will use the following command:
$ uname -s
Output:
The above output showed Linux as the kernel name.
See Linux kernel releases
To print the kernel's release information, use the following command:
$ uname -r
Output:
The above command displayed the Linux release number in the example
See Linux kernel version
To find the kernel version, use the following command:
$ uname -v
Output:
View network node hostname
You can use the following command to print the network node hostname:
$ uname -n
You can also use the following command for the same purpose as it is more user-friendly:
$ uname --nodename
Output:
Both commands will show the same output. Please note that hostname and node name may not be the same for non-Linux systems.
See machine hardware architecture (i386, x86_64, etc.)
To know the hardware architecture of the system you are working with, please use the following command:
$ uname --m
Output:
The x86_64 output indicates that the author is using a 64-bit architecture. i686 output means the user is using a 32-bit system.
See processor type
To know what type of processor you are using, please use the following command:
$ uname -p
Output:
This result shows that the author is using a 64-bit processor.
See hardware platform
To know the hardware platform you are using, please use the following command:
$ uname -i
Output:
In the example case, the output is the same as the machine's hardware name.
View operating system information
The following command will tell you the name of the operating system you are using:
$ uname -o
Output:
The Ubuntu machine in the example displayed the above results for the system.
Find your Linux PC's serial number
Find Linux PC serial number using dmidecode
The easiest way to check your Linux PC serial number is to use dmidecode. After opening Terminal (Ctrl + Alt + T), you can search for your device's serial number with this command:
sudo dmidecode -s system-serial-number
Enter your root password and the command will output your PC's serial number:
This command will not work on all devices. RHEL and CentOS users often encounter problems. If Terminal prompts you saying that SMBIOS implementations newer than version 2.8 are not fully supported by this version of dmidecode, you will need to update your dmidecode with the following DNF package manager command:
dnf update dmidecode
Note: Unfortunately, there is no great way to determine your device's serial number without root permissions.
Use alternate commands to find your PC's serial number
There are several commands besides dmidecode that can help you find your PC's serial number on Linux. If you are using openSUSE, Arch Linux, CentOS, Debian or RHEL, you can also try entering the following command in Terminal:
hwinfo --bios
Of course, you may need to install hwinfo if your device does not have this utility installed. This command will only be successful if your device has a serial number embedded in the BIOS.
If your motherboard supports Direct Media Interface (DMI), you can also find your PC's serial number with the following command:
sudo cat /sys/class/dmi/id/board_serial
Displays all information of the Uname command
The above commands displayed system information according to the type of switch used. In case you want to see all system information at once, use the following command:
$ uname -a
Output:
You can see that the output above shows the complete list of system information to the user.
Displays detailed information about the hardware
Here, the article will describe the commands, in addition to uname, used to extract detailed hardware information of the system:
View hardware information with lshw
The lshw utility allows you to view important hardware information such as memory, CPU, disk drive, etc. from the system. Please run the following command as superuser to view this information:
$ sudo lshw
Output:
The result above is a very detailed version of the system hardware information. You can also view a summary of hardware information as described in the following section.
Brief summary of hardware information
To view a detailed hardware configuration summary, please use the following command:
$ lshw -short
Output:
The output above is a more readable column-wise summary of the hardware configuration.
Create HTML files
The lshw utility also allows you to print your hardware profile to an HTML file as a superuser. Use the following command for this purpose:
$ sudo lshw -html > [filename.html]
For example:
$ sudo lshw -html > hardwareinfo.html
Output:
The above HTML file was created in the /home/user/ directory.
View CPU information with lscpu
The lscpu utility lists detailed CPU information from the sysfs and /proc/cpuinfo files on the screen. Here's how you can use this command:
$ lscpu
Output:
The above output shows CPU architecture, number of CPUs, cores, CPU family model, threads, CPU cache, etc.
View blocking device information with lsblk
The lsblk utility displays information about all the underlying storage devices in the system such as the hard drive, its partitions and the flash drives connected to the system.
$lsblk
You can use the following command to see more detailed information about all devices:
$ lsblk -a
Output:
View USB device information with lsusb
The lsusb command lists information about all USB controllers and the devices connected to them. Please run the following command:
$lsusb
You can also use the following command to view more detailed information about each USB device.
$ lsusb -v
Output:
This output displays all USB controllers and attached devices.
View information about other devices
You can also view information about the following devices on your system:
- PCI devices
$lspci
- SCSI devices
$lsscsi
- SATA devices
$ hdparm [devicelocation] eg $ hdparm /dev/sda2
After working with this guide, you will never fail to retrieve information about Linux and your system's underlying hardware again. This will help you check the system specifications and whether the potential hardware or software is compatible with your system.
You should read it
- Manage the Event Log with the command line
- Displays CPU information via Command Prompt on Windows 10
- The Nox App Player command line parameters support
- Command line parameter in C
- How to use the Linux command line on Android with Termux
- Forget the GUI, the Command Line is returning
- 10 useful commands in Windows you should know
- 5 reasons why people love the Linux command line
- 5 best command line emulation software for Windows 10
- Instructions for managing programs in Ubuntu via the command line
- How to use the command history function in Command Prompt
- How to create a command line program in Python with Click