Skip to content

lshw

The 'lshw' (List Hardware) command in Linux/Unix is a powerful tool for extracting detailed information about the system's hardware configuration. This tool retrieves data from files in the '/proc' directory and is capable of reporting on a wide array of components, including memory configuration, CPU details, firmware version, mainboard configuration, cache memory, bus speed, and more


Create a nifty overview of the hardware in your computer

lshw -html > hardware.html

Output hardware tree as HTML

lshw -html

Output hardware tree as XML

lshw -xml

Output hardware tree as a JSON object

lshw -json

Output hardware paths

lshw -short

Output bus information

lshw -businfo

Use graphical interface

lshw -X

Show the speed of ram-memory

lshw -class memory | grep -i clock

Print info about our ram memory

lshw -class memory

32 bits or 64 bits?

lshw -C cpu|grep width

Show 'Hardware path'-style tree of all devices in Linux

lshw -short

Create a html of information about you harddisk

lshw -C disk -html > /tmp/diskinfo.html

Find installed network devices

lshw -C network

Give information about your graphic chipset

lshw -C display

This option is used to sanitize output i.e. when we don't want sensitive information like serial numbers, etc to be displayed.

lshw -sanitize

Dump data about our network

lshw -C network 

Print speed of network interface

lshw -C network | sed -n 's/^[[:space:]]*size:[[:space:]]*/size: /p'

Hardware detection

lshw | grep -i driver | perl -pe 's/^.*driver=(\S+).*$/$1/g;' | sort -u

Show totaly memory in gigabyte

lshw -json 2>/dev/null |
jq -r '.children[] | select(.id=="core").children[] | select(.id=="memory").size' |
numfmt --to=iec --format '%.0f' | sed 's/$/B/'