When working on headless Linux servers or troubleshooting systems without GUI, these command-line tools become indispensable for hardware diagnostics:
lshw -short
# Shows brief hardware overview
# Requires root privileges for full details:
sudo lshw -html > hardware_report.html
For targeted hardware checks, use these specialized commands:
# CPU information:
cat /proc/cpuinfo
lscpu
# Memory details:
free -h
dmidecode --type memory
# Storage devices:
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
hdparm -i /dev/sda
# PCI devices:
lspci -vv
lspci -tv
For system documentation or support tickets, create detailed reports:
# Generate full hardware report:
sudo lshw -json > system_hardware.json
sudo dmidecode > bios_details.txt
# Network interfaces:
ip -br -c a
ethtool eth0
For deeper hardware analysis:
# Check disk health:
smartctl -a /dev/sda
# USB device tree:
lsusb -tv
# Kernel hardware messages:
dmesg | grep -i 'usb\|sata\|pci'
journalctl --dmesg | grep -i hardware
Create scripts for regular hardware checks:
#!/bin/bash
# Simple hardware monitoring script
DATE=$(date +%F)
{
echo "=== CPU ==="
lscpu
echo "=== Memory ==="
free -h
echo "=== Disk Usage ==="
df -h
} > /var/log/hardware_check_${DATE}.log
When working on headless servers or troubleshooting Linux systems without a graphical interface, these command-line tools become indispensable:
# Basic system overview
sudo lshw -short
# Detailed hardware tree
sudo lshw -html > hardware_report.html
For targeted hardware component information:
# CPU information
lscpu
cat /proc/cpuinfo
# Memory details
free -h
sudo dmidecode --type memory
# Disk configuration
lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT
sudo hdparm -I /dev/sda | grep -i model
For low-level device enumeration:
# PCI devices
lspci -vvv
lspci -tv
# USB device hierarchy
lsusb -tv
lsusb -v
Combine multiple commands into a single diagnostic report:
#!/bin/bash
{
echo "===== SYSTEM HARDWARE REPORT ====="
date
echo -e "\nCPU:"
lscpu
echo -e "\nMEMORY:"
free -h
echo -e "\nDISKS:"
lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT
echo -e "\nPCI DEVICES:"
lspci -tv
} > hardware_report.txt
If additional packages can be installed:
# For Debian/Ubuntu
sudo apt install inxi
# Usage example:
inxi -Fxz