12 Commands to Check Linux System & Hardware Information

12 Commands to Check Linux System & Hardware Information

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.

System info

1. uname

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.

uname -a

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

Where,

  • 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.

system name
uname
system kernel name
uname -s
kernel release
uname -r
kernel version
uname -v
network host name
uname -n
reveal more with the hostnamectl command
hostnamectl
hardware name
uname -m

File system

2. fdisk

Use the 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.

Besides, the fdisk command modifies the file system distributions.

Notes/Articles/12 Commands to Check Linux System & Hardware Information/file system partitions.png

Hardware info

3. lshw

The 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.

sudo lshw

Notes/Articles/12 Commands to Check Linux System & Hardware Information/show hardware info.png

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

4. dmidecode

The 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.

system
sudo dmidecode -t system
CPU
sudo dmidecode -t processor
memory
sudo dmidecode -t memory
BIOS
sudo dmidecode -t bios

Notes/Articles/12 Commands to Check Linux System & Hardware Information/components info.png

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

Bonus Commands

5. free

The free command with the -m flag shows you the total, used and free memory on your device.

free -m

6. df

The df command with the -H flag reveals the file system’s partitions, mount points and disk spaces.

df -H

Notes/Articles/12 Commands to Check Linux System & Hardware Information/free memory and disk space.png

CPU information

7. lscpu

Use the 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

8. lsusb

USB controllers let a USB device communicate with the computer. You can check their information using the lsusb command.

lsusb

OR

lsusb -v # for detailed information

Notes/Articles/12 Commands to Check Linux System & Hardware Information/usb info.png

SATA

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.

9. hdparm

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>

e.g

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.

SCSI devices

Short for Small Computer System Interface, SCSI is a set of standards to physically connect to and transfer data between peripheral devices and computers.

10. lsscsi

You can also use the lsscsi to list SATA and SCSI devices.

lsscsi

OR

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.

Debian-based distros like Ubuntu
sudo apt install lsscsi
RedHat based systems
yum install lsscsi
Fedora 21+ Onwards
dnf install lsscsi

Block devices

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.

11. lsblk

Use the lsblk command to list the block devices.

lsblk

Notes/Articles/12 Commands to Check Linux System & Hardware Information/block devices.png

PCI devices

12. lspci

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 command.

lspci

OR

lspci -v # for detailed information

Conclusion

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.

0 Shares:
Subscribe
Notify of
guest
Receive notifications when your comment receives a reply. (Optional)
Your username will link to your website. (Optional)

0 Comments
Inline Feedbacks
View all comments
You May Also Like
discord and fedora logos on a mauve background
Read More

How to Install Discord on Fedora

[powerkit_collapsibles] [powerkit_collapsible title=”Not using Fedora? Choose a different version or distro.”] Debian 11 Ubuntu 22.04 / 20.04 [/powerkit_collapsible]…