Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
10 Linux Commands to Collect System and Hardware Information
Linux provides numerous built-in commands to gather detailed system and hardware information, essential for troubleshooting, performance monitoring, and system administration. These commands allow administrators and users to inspect everything from basic system details to comprehensive hardware specifications without requiring external tools.
Basic System Information Commands
uname - System Information
The uname command displays fundamental system information including kernel version, architecture, and operating system details.
$ uname -a
Linux hostname 5.4.0-74-generic #83-Ubuntu SMP Sat May 8 02:35:39 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
uptime - System Runtime
Shows how long the system has been running along with current load averages.
$ uptime
14:30:25 up 5 days, 12:15, 2 users, load average: 0.15, 0.20, 0.18
Hardware Detection Commands
lshw - Detailed Hardware Information
Provides comprehensive hardware details including CPU, memory, storage, and peripheral information. Requires installation on most systems.
$ sudo lshw -short
lspci - PCI Devices
Lists all PCI buses and connected devices, useful for identifying graphics cards, network adapters, and other expansion cards.
$ lspci
lsusb - USB Devices
Displays information about USB buses and connected devices.
$ lsusb
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
Storage and Disk Information
lsblk - Block Devices
Lists all available block devices in a tree format, showing device hierarchy and mount points.
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 500G 0 disk ??sda1 8:1 0 512M 0 part /boot/efi ??sda2 8:2 0 499G 0 part /
df - Disk Space Usage
Shows filesystem disk space usage with the -h flag for human-readable format.
$ df -h
Filesystem Size Used Avail Use% Mounted on /dev/sda2 489G 145G 319G 32% / /dev/sda1 511M 5.3M 506M 2% /boot/efi
Memory and Process Monitoring
free - Memory Usage
Displays system memory usage including total, used, free, and cached memory.
$ free -h
total used free shared buff/cache available
Mem: 7.7Gi 2.1Gi 4.2Gi 256Mi 1.4Gi 5.1Gi
Swap: 2.0Gi 0B 2.0Gi
top - Process Monitor
Provides real-time view of running processes with CPU and memory usage statistics.
$ top
htop - Enhanced Process Viewer
An improved version of top with color coding and interactive interface. Requires installation.
$ htop
System Messages and Kernel Information
dmesg - Kernel Messages
Displays kernel ring buffer messages, including boot messages and hardware detection logs.
$ dmesg | tail -20
lsmod - Loaded Kernel Modules
Shows currently loaded kernel modules and their dependencies.
$ lsmod
Network Information Commands
ip - Network Configuration
Modern replacement for ifconfig, shows network interface configuration and routing information.
$ ip addr show
iwconfig - Wireless Configuration
Displays wireless network interface information including SSID, signal strength, and encryption settings.
$ iwconfig
Command Usage Summary
| Command | Purpose | Key Options |
|---|---|---|
| uname | System information | -a (all info), -r (kernel) |
| lshw | Hardware details | -short, -html |
| lsblk | Block devices | -f (filesystems) |
| free | Memory usage | -h (human readable) |
| df | Disk space | -h (human readable) |
| top/htop | Process monitoring | Interactive interface |
Conclusion
These Linux commands provide comprehensive system and hardware information essential for system administration and troubleshooting. Mastering these tools enables efficient monitoring of system resources, hardware detection, and performance analysis. Regular use of these commands helps maintain system health and quickly identify potential issues.
