When working with Linux systems, understanding your hardware specifications is crucial for performance tuning, troubleshooting, and capacity planning. Here's a comprehensive list of commands to extract detailed hardware information:
cat /proc/cpuinfo | grep "model name" | head -n 1
lscpu
dmidecode -t processor
free -h
cat /proc/meminfo | grep MemTotal
dmidecode -t memory
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
df -h
hdparm -I /dev/sda | grep -i "model"
For comprehensive hardware details, consider these powerful tools:
sudo lshw -short
inxi -Fx
hwinfo --short
To get a quick overview of all hardware components (requires root privileges):
sudo lshw -html > system_report.html
For a quick check of disk performance characteristics:
sudo hdparm -Tt /dev/sda
Here's a bash script to collect essential hardware information:
#!/bin/bash
echo "===== SYSTEM HARDWARE REPORT ====="
date
echo -e "\nCPU INFO:"
lscpu | grep -E "Model name|Socket|Core|Thread"
echo -e "\nMEMORY INFO:"
free -h
echo -e "\nDISK INFO:"
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
echo -e "\nEND OF REPORT"
Remember that some commands require root privileges to display complete information. When working on production systems, consider using sudo
with appropriate caution.
When administering Linux systems, knowing how to extract hardware specifications directly from the command line is essential for troubleshooting, capacity planning, and system documentation. While GUI tools exist, command-line methods work across all distributions and in headless environments.
The most comprehensive processor details can be found in the /proc/cpuinfo file:
cat /proc/cpuinfo | grep "model name" | uniq
For more detailed architecture information:
lscpu
To view installed RAM capacity and configuration:
free -h
For detailed memory module information:
sudo dmidecode --type memory
To list all storage devices and their capacities:
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
For SATA/SAS drive specifications (requires root):
sudo hdparm -I /dev/sda | grep -i "model\|capacity"
The lshw command provides a comprehensive hardware report:
sudo lshw -short
For a more readable JSON output:
sudo lshw -json
Some distributions include additional utilities:
# For RedHat-based systems
sudo dnf install inxi
inxi -Fxz
# For Debian-based systems
sudo apt install hardinfo
Create a script to collect hardware specs periodically:
#!/bin/bash
DATE=$(date +%Y-%m-%d)
{
echo "=== CPU ==="
lscpu
echo "=== MEMORY ==="
free -h
echo "=== STORAGE ==="
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
} > hardware_report_$DATE.txt
To inspect network interfaces and their capabilities:
lspci | grep -i ethernet
ethtool eth0