cheat-sheets

Hardware Inspection

List the PCI and USB devices, CPU, memory, disks and firmware details of a Linux machine with lspci, lsusb, lshw, dmidecode and friends. Use it to identify a NIC or GPU for passthrough, check which kernel driver is bound, or confirm RAM speed and slots.

Documentation: lspci(8) · lsusb(8) · dmidecode(8) · lscpu(1)

Verification: options were checked against the man pages in Ubuntu 24.04 (pciutils, usbutils, lshw, dmidecode, util-linux). Output depends on the hardware; most commands need sudo for full detail.

PCI #

COMMANDDESCRIPTION
lspciList PCI devices
lspci -nnInclude numeric vendor and device IDs ([8086:1234])
lspci -kShow the kernel driver in use and available modules
lspci -v / lspci -vvVerbose / very verbose (link speed, capabilities; sudo for all)
lspci -s <BUS:SLOT.FUNC>One device, e.g. -s 01:00.0
lspci -d <VENDOR>:<DEVICE>Filter by ID
lspci -tvTree view of buses and bridges
lspci -nnk | grep -A3 -i vgaGPU with its driver

USB #

COMMANDDESCRIPTION
lsusbList USB devices
lsusb -tTree with drivers and negotiated speed
lsusb -v -d <VENDOR>:<PRODUCT>Full descriptor for one device

CPU and Memory #

COMMANDDESCRIPTION
lscpuCPU model, cores, threads, caches and virtualisation flags
lscpu -eOne line per logical CPU
grep -m1 -oE 'vmx|svm' /proc/cpuinfoHardware virtualisation support (vmx Intel, svm AMD)
free -hMemory and swap usage
sudo dmidecode -t memoryInstalled DIMMs: size, speed, slot, manufacturer
sudo dmidecode -t processorCPU socket and speed data

Disks #

COMMANDDESCRIPTION
lsblkBlock devices as a tree
lsblk -fFilesystems, labels and UUIDs
lsblk -o NAME,SIZE,MODEL,SERIAL,ROTAChosen columns (ROTA 1 = spinning disk)
sudo smartctl -a /dev/<DISK>SMART health (from smartmontools)
ls -l /dev/disk/by-id/Stable device names

System and Firmware #

COMMANDDESCRIPTION
sudo dmidecode -t systemManufacturer, model, serial
sudo dmidecode -t biosBIOS version and date
sudo dmidecode -t baseboardMotherboard details
sudo dmidecode -s system-product-nameSingle string
sudo lshw -shortOne-line overview of all hardware
sudo lshw -class networkOne class: network, disk, display, memory
sudo lshw -businfoBus addresses (PCI, USB, SCSI)
hostnamectlOS, kernel and hardware vendor or virtualisation type

Kernel Modules and Drivers #

COMMANDDESCRIPTION
lsmodLoaded kernel modules
modinfo <MODULE>Module details and parameters
sudo dmesg | grep -i <DEVICE>Kernel messages about a device
ls /sys/bus/pci/devices/PCI devices as the kernel sees them

IOMMU Groups #

Check how devices are grouped before PCIe passthrough:

bash
for g in /sys/kernel/iommu_groups/*; do
  echo "Group ${g##*/}"
  for d in "$g"/devices/*; do lspci -nns "${d##*/}"; done
done

See Also #

Search all sheets

Tip: / or Ctrl/Cmd+K to open, Esc to close.