lshw
Overview
lshw (list hardware) probes the system and prints a hardware tree: CPU, memory, storage, network, firmware, and buses. Run as root (or with capabilities) for full DMI/PCI detail; unprivileged runs omit sensitive or privileged data.
sudo apt install lshw
sudo dnf install lshwSyntax
sudo lshw [options]Common Options
| Option | Description |
|---|---|
-short |
Compact table |
-class CLASS / -C |
Filter: network, disk, memory, cpu, system, display, storage, power, … |
-businfo |
Bus addresses / logical names |
-json / -xml / -html |
Export formats |
-sanitize |
Hide serials and UUIDs for sharing |
-numeric |
Numeric IDs |
-quiet |
Less noise |
-enable / -disable tests |
Control probe tests (see man) |
Key Use Cases
- Inventory machines for asset management
- Identify NIC driver/logical name mismatches
- Confirm RAM/slots and disk models
- Generate sanitized HTML/JSON for tickets
Examples with Explanations
Quick overview
sudo lshw -short
sudo lshw -class system -shortNetwork and disks
sudo lshw -class network -short
sudo lshw -C network -businfo
sudo lshw -class disk
sudo lshw -class storageMemory and CPU
sudo lshw -class memory
sudo lshw -class cpu -shortExport
sudo lshw -json > /tmp/hw.json
sudo lshw -sanitize -html > /tmp/hw.html
sudo lshw -json | jq '.[].class' 2>/dev/null | sort -uOne-liner recipes
# MAC and product for NICs
sudo lshw -class network | egrep 'description|product|serial|logical name|capacity'
# Disk models
sudo lshw -class disk | egrep 'description|product|serial|size|logical name'
# Compare businfo to ip link
sudo lshw -C network -businfo; ip -br linkNotes & Pitfalls
- Without root, expect incomplete PCI/DMI data.
- Virtual machines report virtual hardware; use cloud metadata APIs for instance type.
- Probing can be slow on large systems; class filters help.
- Serial numbers are sensitive—use
-sanitizebefore pasting into public issues. - Prefer
lscpu,lsblk,ip linkfor single-purpose questions;lshwis the wide inventory tool.
2026-relevant notes
- On servers,
dmidecode,lshw, andlscpu/lsblkremain the classic trio; some fleets useinxi,hwinfo, or vendor out-of-band (iDRAC/iLO) for authoritative inventory. - NVMe and virtual NICs rename often (
ens,enp,eth)—trustbusinfo+ip linktogether. - JSON export helps config-management facts when agent-based inventory isn’t installed.
Additional Resources
man lshw- Upstream ezix.org lshw documentation