lshw reports memory configuration, firmware versions, mainboard configuration, CPU version and speed, cache configuration, bus speed, hardware paths, attached devices, partitions, and filesystems. Try the lshw (Hardware Lister) command with no options, and store the output in a text file:
$ sudo lshw | tee hardware.txt duchess description: Laptop product: Latitude E7240 (05CA) vendor: Dell Inc. version: 00 serial: 456ABC1 width: 64 bits ...
You’ll get several hundred lines of output that include firmware, drivers, capabilities, serial numbers, version numbers, and bus information. lshw will not probe any device attached via a wireless network interface, such as a wireless printer, or a smartphone attached via Bluetooth, but it will report wireless and Bluetooth interfaces.
You may prefer a summary in a hardware path tree view:
$ sudo lshw -short
If you encounter the below error while running the lshw command:
lshw: command not found
you may try installing the lshw package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install lshw |
Ubuntu | apt-get install lshw |
Alpine | apk add lshw |
Arch Linux | pacman -S lshw |
Kali Linux | apt-get install lshw |
CentOS | yum install lshw |
Fedora | dnf install lshw |
Raspbian | apt-get install lshw |
lshw Command Examples
1. Launch the GUI:
# lshw -X
2. List all hardware in tabular format:
# lshw -short
3. List all disks and storage controllers in tabular format:
# lshw -class disk -class storage -short
4. Save all network interfaces to an HTML file:
# lshw -class network -html > interfaces.html
5. Run sudo lshw -short or sudo lshw -businfo to see a list of device classes, then name one or more device classes that you want to see:
# lshw -short -class bus -class cpu
Omit the -short option to see detailed information.
6. Format the long output as HTML, XML, or JSON, and store it in a file so you can use your favorite scripting hacks to parse the output:
# lshw -html -class bus -class cpu | tee lshw.html # lshw -xml -class printer -class display -class input | tee lshw.xml # lshw -json -class storage | tee lshw.json
Remove sensitive information with the -sanitize option, such as IP addresses and serial numbers, to make it safer to share with technical support:
# lshw -json -sanitize -class bus -class cpu
7. Display the memory section of a system’s hardware profile:
# lshw -class memory