Whether you are a Linux beginner user who wants to learn new commands or a frequent user who only needs a quick reminder, this tutorial is for you.
In this article we’ll explain 12 typical commands to check Linux system and hardware information.
Table of Contents
You can know the system name or kernel name, system version or release, host or hardware name using the uname command with the -a flag.
You should get an input similar to mine:
Linux bytexd 5.13.0-41-generic #46~20.04.1-Ubuntu SMP Wed Apr 20 13:16:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
- Linux: system name,
- bytexd: network host name,
- 5.13.0-41-generic: kernel release
- #46~20.04.1-Ubuntu SMP Wed Apr 20 13:16:21 UTC 2022: kernel version, and
- x86_64: hardware name
The kernel is a program at the operating system’s core to control every system operation. The code lives in the memory to manage hardware and software interactions. For example, the kernel boots the system, device drivers, or charges and stops charging the device.
The SMP, short for Symmetrical Multi-processing, means a multiprocessor architecture with no CPU chosen as the main one. So from the above output, kernel version is 33 on Ubuntu version 20.04, dated seventh February at 2:25 p.m, 2022, in UTC time.
Alternatively, you can get info about specific components by running their respective commands.
fdisk command with the
sudo command and the -l flag to check the file system partitions.
sudo fdisk -l
A partition is a logical hard disk division. The operating and file systems treat the divisions as a separate entity and manage them as if they are distinct hard drives.
fdisk command modifies the file system distributions.
lshw tool with the
sudo command helps know the machine’s detailed hardware configuration. For instance, you can use the tool to inquire about the motherboard, RAM, or cache configurations, firmware version, bus speed, and CPU and speed.
Apart from the long list of settings, you can get a summarized configuration data by appending the -short flag to the lshw command.
sudo lshw -short
The motherboard glues the system together, easing their intercommunication. RAM holds the currently used data, which fades when you switch off the computer. On the other hand, the cache is a small and fast memory component inserted between the RAM and the CPU to hold the frequently used data.
In the absence of power, the firm software, short for firmware, holds the low-level instructions. It lies on the motherboard, hosting hardware, and BIOS settings.
As the name suggests, the bus joins the computer components, enabling data transfer. Lastly, the processor (also known as the CPU) executes instructions, such as arithmetic and control functions.
Now that you understand the primary hardware components, let’s check them.
Memory, BIOS, and Processor
dmidecode command with the
sudo command and the
-t flag checks the system, CPU, memory and BIOS information. You can use it to check the target component’s information, as follows.
sudo dmidecode -t system
sudo dmidecode -t processor
sudo dmidecode -t memory
sudo dmidecode -t bios
Apart from the
-t flag, you can specify the ID from DMI table to get information about a specific hardware component. For example, appending code 0 after the -t flag reveals the BIOS information.
sudo dmidecode -t 0
free command with the
-m flag shows you the total, used and free memory on your device.
The df command with the -H flag reveals the file system’s partitions, mount points and disk spaces.
lscpu command to check the CPU information.
Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian Address sizes: 39 bits physical, 48 bits virtual CPU(s): 2 On-line CPU(s) list: 0,1 Thread(s) per core: 1 Core(s) per socket: 2 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 158 Model name: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz Stepping: 9 CPU MHz: 4199.996 BogoMIPS: 8399.99 Hypervisor vendor: KVM Virtualization type: full L1d cache: 64 KiB L1i cache: 64 KiB L2 cache: 512 KiB L3 cache: 16 MiB NUMA node0 CPU(s): 0,1 Vulnerability Itlb multihit: KVM: Mitigation: VMX unsupported Vulnerability L1tf: Mitigation; PTE Inversion Vulnerability Mds: Mitigation; Clear CPU buffers; SMT Host state unknown Vulnerability Meltdown: Mitigation; PTI Vulnerability Spec store bypass: Vulnerable Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Retpolines, STIBP disabled, RSB filling Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nons top_tsc cpuid tsc_known_freq pni ssse3 cx16 pcid sse4_1 sse4_2 hypervisor lahf_lm invpcid_single pti fsgsbase invpcid md_clear flush_l1d arch_capabilities
- Architecture is the arrangement of the CPU components.
- CPU op-mode(s) is the Linux version the system runs. If you see both 32 and 64-bit modes, your machine runs a 64-bit system. If you only see 32-bit, the computer is 32-bit.
- Byte Order of Little Endian value means my system prioritizes the least significant data units when ordering data in the memory. CPU(s) symbolize the number of cores assigned to the system, 4 in my system.
USB controllers let a USB device communicate with the computer. You can check their information using the lsusb command.
lsusb -v # for detailed information
Short for Serial Advanced Technology Attached, SATA is an interface to transfer data between storage devices and the motherboard. It is preferred to PATA (Parallel Commands to Check Linux System & Hardware Information) because it is quicker in data transfer.
You can check SATA disk info like serial number and model by specifying the device path after the sudo and hdparm command.
sudo hdparm <device name>
sudo hdparm /dev/sda
The dev folder contains files attached to the local system. Most of its files are partitioned in alphabetical order.
For example, /dev/sda is the primary hard drive while /dev/sdb is secondary. The numbers after the drive name denote the partition order. For example, /dev/sda1 represents the first drive’s first partition.
Short for Small Computer System Interface, SCSI is a set of standards to physically connect to and transfer data between peripheral devices and computers.
You can also use the
lsscsi to list SATA and SCSI devices.
lsscsi -s # to show device sizes
In Linux, SCSI devices are named to help identify them. Like the SATA devices, the SCSI devices are labelled in alphabetical order. For example, /dev/scd0 is the first SCSI device.
If your system does not have the
lsscsi tool, install it using your system’s installation package.
sudo apt install lsscsi
yum install lsscsi
dnf install lsscsi
A block device moves data in byte/bit sequences. Examples of block devices are CD-ROM, flash, or hard drives. You can physically attach the devices to the computer and access them remotely.
lsblk command to list the block devices.
A Peripheral Component Interconnect (PCI) joins various peripheral devices to the Linux platform. Any device connecting to the PCI slot is called a PCI device. You can find more about the devices by running the
lspci -v # for detailed information
There are many commands to check the Linux system and hardware information. As shown in this tutorial, you can comfortably remember the typical commands by understanding and grouping related devices.