Linux Commands GuideLinux Tutorials

11 Essential Linux Commands to Collect Detailed System and Hardware Information

When managing Linux servers or desktops, a deep understanding of the underlying hardware and system components is critical for effective administration, troubleshooting, and performance tuning. Whether you’re deploying new software, diagnosing hardware issues, or verifying resource availability, knowing how to gather accurate system and hardware details is a must-have skill for every Linux administrator. In this article, I will walk you through 11 powerful Linux commands that let you collect comprehensive information about your CPU, memory, disks, USB devices, PCI devices, and more. These commands are indispensable tools that I regularly use in production environments to quickly assess system health and compatibility. By mastering these commands, you’ll gain insights not just into what your Linux machine is, but how it performs and what it supports. Let’s dive in.

1. Get Basic System and Kernel Info with uname

The uname command is your first stop when you want a quick snapshot of the kernel and system architecture. It reports the operating system name, kernel version, hostname, and platform details.

uname -a

Linux prod-server 5.4.0-108-generic #122-Ubuntu SMP Fri Jan 14 21:15:02 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

This command prints all available system information in one go. The flags used here are:
-a – Show kernel name, hostname, kernel release, version, machine, processor, hardware platform, and OS.
System administrators use uname typically during troubleshooting to verify kernel versions or when they prepare system documentation before upgrades.

2. Detailed Hardware Profiling Using lshw

lshw is a powerful utility that extracts detailed information about hardware components like CPU, memory, disks, buses, and USB controllers by scanning various system files. It’s invaluable when you need a precise hardware inventory.

sudo lshw -short

H/W path       Device    Class          Description
====================================================
system         -         system         Toshiba Satellite L50-B
/0             -         bus            Motherboard
/0/0           -         memory         64KiB BIOS
/0/4           -         processor      Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
/0/100         -         memory         16GiB System Memory
/0/100/1       -         memory         8GiB DIMM DDR4 Synchronous 2133 MHz
/0/100/2       -         memory         8GiB DIMM DDR4 Synchronous 2133 MHz
/0/1f.2        -         storage        SATA controller
/0/1f.3        -         communication  Intel Sunrise Point-LP CSME HECI

Here, -short provides a summarized list making it easier to scan quickly. You need superuser privileges because accessing hardware details requires elevated rights.
In real production environments, lshw helps to gather hardware specs during audits or before deploying hardware-specific drivers.

3. CPU Details at a Glance with lscpu

lscpu retrieves CPU architecture info straight from /proc/cpuinfo and sysfs. It reports number of CPUs, cores, threads, vendor, caches, and flags.

lscpu

Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              8
On-line CPU(s) list: 0-7
Thread(s) per core:  2
Core(s) per socket:  4
Socket(s):           1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               142
CPU MHz:             800.000
L1d cache:           32K
L1i cache:           32K
L2 cache:            256K
L3 cache:            8192K

This command is vital before compiling kernel modules or troubleshooting performance since it clarifies your CPU’s capabilities and topology.

4. Storage Device Info Overview with lsblk

lsblk lists information about block devices such as hard drives, SSDs, partitions, and removable media. It’s frequently used to check mount points and the hierarchy of devices.

lsblk -f

NAME   FSTYPE LABEL    UUID                                 MOUNTPOINT
sda                                                  
├─sda1 ext4   rootfs   a8f3e907-0c6d-4b6f-8f4d-17fab3c0b7e5 /
├─sda2 swap            e760a4fc-d7fe-4c2a-9f80-1d4762a6f7ba [SWAP]
└─sda3 ext4   home     4b3cadf0-0beb-4e53-bf00-b4b135769f86 /home

Flags:
-f shows filesystem type and UUID.
Administrators use this during disk setup or when verifying filesystem mounts and checking whether partitions are configured properly.

5. Inspect USB Devices with lsusb

lsusb lists all USB buses and connected USB devices, which is extremely useful when you need to confirm if USB peripherals, dongles, or hubs are detected by the Linux system.

lsusb

Bus 001 Device 002: ID 8087:8000 Intel Corp. 
Bus 001 Device 003: ID 045e:07f8 Microsoft Corp. 
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Adding -v gives verbose details including device descriptors and configurations, often required when debugging USB issues or developing USB drivers.

6. Query PCI Devices Using lspci

PCI components such as GPUs, NICs, and other expansion cards can be inspected with lspci, which reports device types and vendor info.

lspci -nn

00:00.0 Host bridge [0600]: Intel Corporation Device [8086:191f] (rev 07)
00:02.0 VGA compatible controller [0300]: Intel Corporation Device [8086:191b] (rev 07)
02:00.0 Network controller [0280]: Intel Corporation Wireless 8265 / 8275 [8086:24fd] (rev 78)

The -nn flag appends numeric PCI vendor and device IDs.
This command is crucial for checking hardware presence and vendor details before installing proprietary drivers.

7. Use lsscsi to Display SCSI Devices

The lsscsi command lists all SCSI and SATA storage devices. It’s highly useful in enterprise environments where many disks are attached through SCSI controllers.

sudo lsscsi -s

[0:0:0:0]    disk    ATA      Samsung SSD 860  1B6Q  /dev/sda  500GB
[1:0:0:0]    cd/dvd  HL-DT-ST DVD+-RW GUD0N   A100  /dev/sr0   -

-s adds device size information.
I often use this command when managing RAID setups or verifying whether new storage devices are detected.

8. Fetch SATA Drive Details Using hdparm

hdparm provides low-level info and tuning capabilities for SATA disks. You can inspect disk geometry, transfer modes, and read/write speeds.

sudo hdparm -I /dev/sda

/dev/sda:
 Model Number:       Samsung SSD 860 EVO 500GB
 Serial Number:      S3Z9NB0K701234X
 Firmware Revision:  RVT01B6Q
 Configurations:
  Logical   Sector size:           512 bytes
  Physical  Sector size:           512 bytes
  Device size with M = 1024*1024:  500 GB

The -I flag shows detailed device info. I use this tool to verify drive specs and troubleshoot disk-related performance issues.

9. Assess Filesystem Partition Info with fdisk

fdisk primarily modifies partitions but its -l flag lists all partitions on your disks, helping confirm disk layout and bootable partitions.

sudo fdisk -l

Disk /dev/sda: 500 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Samsung SSD 860 EVO 500GB
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: XXXX-XXXX-XXXX-XXXX

Device         Start       End   Sectors  Size Type
/dev/sda1         2048    1050623   1048576  512M EFI System
/dev/sda2      1050624 976773167 975722544 465.3G Linux filesystem

This is a quick command I run when preparing new systems or diagnosing boot-related issues.

10. Retrieve DMI/SMBIOS Information with dmidecode

dmidecode reads DMI tables to display detailed hardware info supplied by the BIOS, like system manufacturer, serial numbers, BIOS version, memory slots, and processor details.

sudo dmidecode -t system

# dmidecode 3.2
SMBIOS 3.0 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: Dell Inc.
        Product Name: PowerEdge R730
        Version: Not Specified
        Serial Number: ABC1234
        UUID: 4c4c4544-0036-4410-804a-b6c04f4a3145
        Wake-up Type: Power Switch

Common use cases include inventorying hardware serial numbers and validating BIOS versions before firmware upgrades.

11. The All-in-One Tool: inxi

inxi is a comprehensive script that aggregates data from various sources to display a readable overview of most hardware and system details. It’s handy when you need a quick and extensive report.

inxi -Fxz

System:    Host: prod-server Kernel: 5.4.0-108-generic x86_64 bits: 64 Desktop: N/A
Machine:   Type: Server Mobo: Dell model: PowerEdge R730 serial: [Redacted]
CPU:       2x Intel Xeon E5-2630 v3 @ 2.40GHz (16 cores)
Memory:    64GB (DDR4)
Storage:   4x 1TB SAS HDDs in RAID5
Network:   2x Intel X550 10GbE NICs

Flags:
-F for full output, -x for extra details, -z to omit sensitive info.
One useful trick many administrators overlook is combining inxi with script output piped to a log file for remote troubleshooting.

Best Practices

When working on production servers, always run commands like lshw and dmidecode with sudo to get complete results. Avoid parsing raw files in /proc manually unless necessary; use dedicated tools for more reliable output. Always keep an up-to-date hardware inventory, combining inxi reports with configuration management tools like Ansible to automate hardware audits. Remember to verify hardware compatibility before kernel or driver upgrades using outputs from commands like lspci and lsusb. And finally, strip sensitive data when sharing command output externally.

Troubleshooting Scenario

In one troubleshooting case I handled, a server kept rebooting unexpectedly. Using dmidecode, I verified the exact BIOS version and serial number to cross-check firmware updates. The lshw command revealed a memory DIMM reported as “empty,” which did not match physical inspection. This pointed us to a faulty RAM slot, allowing targeted hardware replacement before complete system failure. Without these commands, the problem would have involved longer downtime and guesswork.

Conclusion

Mastering these 11 Linux commands gives you a toolkit to confidently extract system and hardware details for diverse Linux environments. From quick kernel checks with uname to deep dives into hardware inventories with lshw and dmidecode, these commands equip you to plan upgrades, troubleshoot obscure issues, and maintain healthy, reliable Linux systems. Always pair this knowledge with proper permissions and good security practices. As an experienced admin, knowing when and how to use each of these commands can save hours of diagnostic time and prevent costly downtime in production.

Leave a Reply

Your email address will not be published. Required fields are marked *