lshw (stands for Hardware Lister) is a small nifty tool that generates detailed reports about various hardware components on the machine such as memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, usb, network card, graphics cards, multimedia, printers, bus speed, etc.
It’s generating hardware information by reading varies files under /proc directory and DMI table.
lshw must be run as super user to detect the maximum amount of information or it will only report partial information. Special option is available in lshw called class which will shows specific given hardware information in detailed manner.
Also read a following articles which is related to Linux hardware.
Suggested Read :
(#) ScreenFetch – Fetch Linux System Information on Terminal with Distribution ASCII art logo
(#) inxi – A Great Tool to Check Hardware Information on Linux
(#) Dmidecode – Easy Way To Get Linux System Hardware Information
(#) 16 Methods To Check If A Linux System Is Physical or Virtual Machine
Refer the following table for available classes. The same information can be found using lshw -short or lshw -businfo.
Class Examples --------------------------------------------------------------------------- system laptop, server, desktop computer bridge PCI-to-PCI brige, AGP bridge, PCMCIA controler, host bridge memory RAM, BIOS, firmware, extension ROM processor CPUs, RAID controller on a SCSI bus address extension ROM, video memory storage SCSI controller, IDE controller disk discs, optical storage (CD-ROM, DVD±RW...) tape DAT, DDS bus USB, SCSI, Firewire network Ethernet, FDDI, WiFi, Bluetooth display EGA/VGA, UGA... input keyboards, mice, joysticks... printer printer, all-in-one multimedia sound card, TV-output card, video acquisition card communication serial ports, modem power power supply, internal battery volume filesystem, swap, etc. generic generic device (used when no pre-defined class is suitable)
How to install lshw on Linux
It’s available in default repository so install the package from distribution official repository.
For Debian/Ubuntu, use apt-get command or apt command to install lshw.
$ sudo apt-get install lshw
For RHEL/CentOS, use yum command to install lshw.
$ sudo yum install lshw
For Fedora, use dnf command to install lshw.
$ sudo dnf install lshw
For Arch Linux, use pacman command to install lshw.
$ sudo pacman -S lshw
For openSUSE, use zypper command to install lshw.
$ sudo zypper install lshw
Display full information
When you run lshw without any options would generate all the detected hardware report in single shot which is no use since you can’t see any information properly.
# lshw
centos.2daygeek.com
description: Computer
product: OpenStack Nova
vendor: OpenStack Foundation
version: 2014.2.4
serial: 00000000-0000-0000-0000-0cc47adf35e8
width: 64 bits
capabilities: smbios-2.8 dmi-2.8 vsyscall64 vsyscall32
configuration: boot=normal uuid=94EAE895-EB2B-874F-AFCC-2F2FD9AB0F70
*-core
description: Motherboard
physical id: 0
*-firmware
description: BIOS
vendor: SeaBIOS
physical id: 0
version: 2:1.10.2-6e899082
date: 04/01/2014
size: 96KiB
*-cpu
description: CPU
product: Intel Core Processor (Haswell, no TSX)
vendor: Intel Corp.
vendor_id: GenuineIntel
physical id: 400
bus info: cpu@0
version: pc-i440fx-vivid
slot: CPU 0
size: 2GHz
capacity: 2GHz
width: 64 bits
capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp x86-64 constant_tsc up rep_good unfair_spinlock pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm xsaveopt tpr_shadow vnmi flexpriority ept vpid fsgsbase bmi1 avx2 smep bmi2 erms invpcid
configuration: cores=1 enabledcores=1 threads=1
Display information using short or businfo
This will generate a good report about the hardware devices based on class options. The output split into four parts H/W path, Device, class and Description with N partitions.
# lshw -short
H/W path Device Class Description
===================================================
system OpenStack Nova
/0 bus Motherboard
/0/0 memory 96KiB BIOS
/0/400 processor Intel Core Processor (Haswell, no TSX)
/0/1000 memory 2000MiB System Memory
/0/1000/0 memory 2000MiB DIMM RAM
/0/100 bridge 440FX - 82441FX PMC [Natoma]
/0/100/1 bridge 82371SB PIIX3 ISA [Natoma/Triton II]
/0/100/1.1 storage 82371SB PIIX3 IDE [Natoma/Triton II]
/0/100/1.2 bus 82371SB PIIX3 USB [Natoma/Triton II]
/0/100/1.2/1 usb1 bus UHCI Host Controller
/0/100/1.2/1/1 input QEMU USB Tablet
/0/100/1.3 bridge 82371AB/EB/MB PIIX4 ACPI
/0/100/2 display GD 5446
/0/100/3 eth0 network Virtio network device
/0/100/4 storage Virtio SCSI
/0/100/5 generic Virtio memory balloon
/0/1 scsi2 storage
/0/1/0.0.0 /dev/sda disk 10GB SCSI Disk
/0/1/0.0.0/1 /dev/sda1 volume 10239MiB EXT4 volume
/1 veth9b2c1e1 network Ethernet interface
/2 veth2097baa network Ethernet interface
/3 vethd79ee71 network Ethernet interface
Print a hardware details based on class using businfo option.
# lshw -businfo
Bus info Device Class Description
=====================================================
system OpenStack Nova
bus Motherboard
memory 96KiB BIOS
cpu@0 processor Intel Core Processor (Haswell, no TSX)
memory 2000MiB System Memory
memory 2000MiB DIMM RAM
pci@0000:00:00.0 bridge 440FX - 82441FX PMC [Natoma]
pci@0000:00:01.0 bridge 82371SB PIIX3 ISA [Natoma/Triton II]
pci@0000:00:01.1 storage 82371SB PIIX3 IDE [Natoma/Triton II]
pci@0000:00:01.2 bus 82371SB PIIX3 USB [Natoma/Triton II]
usb@1 usb1 bus UHCI Host Controller
usb@1:1 input QEMU USB Tablet
pci@0000:00:01.3 bridge 82371AB/EB/MB PIIX4 ACPI
pci@0000:00:02.0 display GD 5446
pci@0000:00:03.0 eth0 network Virtio network device
pci@0000:00:04.0 storage Virtio SCSI
pci@0000:00:05.0 generic Virtio memory balloon
scsi2 storage
scsi@2:0.0.0 /dev/sda disk 10GB SCSI Disk
scsi@2:0.0.0,1 /dev/sda1 volume 10239MiB EXT4 volume
veth9b2c1e1 network Ethernet interface
veth2097baa network Ethernet interface
vethd79ee71 network Ethernet interface
Display system information
To display information about the system and related details, use system class.
# lshw -class system
centos.2daygeek.com
description: Computer
product: OpenStack Nova
vendor: OpenStack Foundation
version: 2014.2.4
serial: 00000000-0000-0000-0000-0cc47adf35e8
width: 64 bits
capabilities: smbios-2.8 dmi-2.8 vsyscall64 vsyscall32
configuration: boot=normal uuid=94EAE895-EB2B-874F-AFCC-2F2FD9AB0F70
Display memory information
To display information about a memory and related details, use memory class.
# lshw -class memory
*-firmware
description: BIOS
vendor: SeaBIOS
physical id: 0
version: 2:1.10.2-6e899082
date: 04/01/2014
size: 96KiB
*-memory
description: System Memory
physical id: 1000
size: 2000MiB
capacity: 2000MiB
*-bank
description: DIMM RAM
vendor: QEMU
physical id: 0
slot: DIMM 0
size: 2000MiB
Display Processor information
To display information about the processor and related details, use processor class. This will print processor name, capacity, clock speed, etc,.,
# lshw -class processor
*-cpu
description: CPU
product: Intel Core Processor (Haswell, no TSX)
vendor: Intel Corp.
vendor_id: GenuineIntel
physical id: 400
bus info: cpu@0
version: pc-i440fx-vivid
slot: CPU 0
size: 2GHz
capacity: 2GHz
width: 64 bits
capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp x86-64 constant_tsc up rep_good unfair_spinlock pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm xsaveopt tpr_shadow vnmi flexpriority ept vpid fsgsbase bmi1 avx2 smep bmi2 erms invpcid
configuration: cores=1 enabledcores=1 threads=1
Display Disk information
To display information about hard disk and related details, use disk class. This will print physical id, bus info, logical name, disk size, capabilities, and configuration, etc,.,
# lshw -class disk
*-disk
description: SCSI Disk
physical id: 0.0.0
bus info: scsi@2:0.0.0
logical name: /dev/sda
size: 10GiB (10GB)
capabilities: partitioned partitioned:dos
configuration: logicalsectorsize=512 sectorsize=512 signature=000352e8
Display Storage information
To display information about storage and related details, use storage class. This will print product name, vendor, physical id, bus info, width, clock, capabilities, and configuration, etc,.,
# lshw -class storage
*-ide
description: IDE interface
product: 82371SB PIIX3 IDE [Natoma/Triton II]
vendor: Intel Corporation
physical id: 1.1
bus info: pci@0000:00:01.1
version: 00
width: 32 bits
clock: 33MHz
capabilities: ide bus_master
configuration: driver=ata_piix latency=0
resources: irq:0 ioport:1f0(size=8) ioport:3f6 ioport:170(size=8) ioport:376 ioport:c0a0(size=16)
*-scsi
description: SCSI storage controller
product: Virtio SCSI
vendor: Red Hat, Inc
physical id: 4
bus info: pci@0000:00:04.0
version: 00
width: 32 bits
clock: 33MHz
capabilities: scsi msix bus_master cap_list
configuration: driver=virtio-pci latency=0
resources: irq:11 ioport:c000(size=64) memory:febd2000-febd2fff
*-scsi
physical id: 1
logical name: scsi2
Display Volume information
To display information about volume and related details, use volume class. This will print file system type, vendor, physical id, bus info, logical name, serial, size, capabilities, and configuration, etc,.,
# lshw -class volume
*-volume
description: EXT4 volume
vendor: Linux
physical id: 1
bus info: scsi@2:0.0.0,1
logical name: /dev/sda1
logical name: /
version: 1.0
serial: 7e192559-d669-4919-840b-4c9a846fafa7
size: 10239MiB
capacity: 10239MiB
capabilities: primary bootable journaled extended_attributes large_files huge_files dir_nlink recover extents ext4 ext2 initialized
configuration: created=2017-03-03 08:55:57 filesystem=ext4 lastmountpoint=/ modified=2017-03-03 09:00:14 mount.fstype=ext4 mount.options=rw,relatime,errors=remount-ro,barrier=1,data=ordered,discard mounted=2017-08-09 02:18:47 state=mounted
Display Disk, Storage & Volume Information
To display information about volume, disk & storage and related details, use following three class disk, storage and volume with short option.
# lshw -short -class disk -class storage -class volume H/W path Device Class Description =================================================== /0/100/1.1 storage 82371SB PIIX3 IDE [Natoma/Triton II] /0/100/4 storage Virtio SCSI /0/1 scsi2 storage /0/1/0.0.0 /dev/sda disk 10GB SCSI Disk /0/1/0.0.0/1 /dev/sda1 volume 10239MiB EXT4 volume
Display Network information
To display information about network and related details, use network class. This will print product name, vendor name, physical id, bus info, interface name, serial, clock speek, capabilities and configuration, etc,.,
# lshw -class network
*-network
description: Ethernet interface
product: Virtio network device
vendor: Red Hat, Inc
physical id: 3
bus info: pci@0000:00:03.0
logical name: eth0
version: 00
serial: fa:16:3e:4c:ef:db
width: 32 bits
clock: 33MHz
capabilities: msix bus_master cap_list rom ethernet physical
configuration: broadcast=yes driver=virtio_net driverversion=1.0.0 ip=66.70.189.137 latency=0 link=yes multicast=yes
resources: irq:10 ioport:c060(size=32) memory:febd1000-febd1fff memory:feb80000-febbffff(prefetchable)
*-network:0
description: Ethernet interface
physical id: 1
logical name: veth9b2c1e1
serial: 22:94:2b:2a:3c:e4
size: 10Gbit/s
capabilities: ethernet physical
configuration: autonegotiation=off broadcast=yes driver=veth driverversion=1.0 duplex=full firmware=N/A link=yes multicast=yes port=twisted pair speed=10Gbit/s
*-network:1
description: Ethernet interface
physical id: 2
logical name: veth2097baa
serial: 92:c1:b0:0a:ff:64
size: 10Gbit/s
capabilities: ethernet physical
configuration: autonegotiation=off broadcast=yes driver=veth driverversion=1.0 duplex=full firmware=N/A link=yes multicast=yes port=twisted pair speed=10Gbit/s
*-network:2
description: Ethernet interface
physical id: 3
logical name: vethd79ee71
serial: 6e:e4:bb:cc:b3:71
size: 10Gbit/s
capabilities: ethernet physical
configuration: autonegotiation=off broadcast=yes driver=veth driverversion=1.0 duplex=full firmware=N/A link=yes multicast=yes port=twisted pair speed=10Gbit/s
Display Bus information
To display information about bus and related details, use bus class. This will print all bus information such as product name, vendor name, physical id, bus info, interface name, serial, clock speed, capabilities and configuration, etc,.,
# lshw -class bus
*-core
description: Motherboard
physical id: 0
*-usb
description: USB controller
product: 82371SB PIIX3 USB [Natoma/Triton II]
vendor: Intel Corporation
physical id: 1.2
bus info: pci@0000:00:01.2
version: 01
width: 32 bits
clock: 33MHz
capabilities: uhci bus_master
configuration: driver=uhci_hcd latency=0
resources: irq:11 ioport:c040(size=32)
*-usbhost
product: UHCI Host Controller
vendor: Linux 2.6.32-696.6.3.el6.x86_64 uhci_hcd
physical id: 1
bus info: usb@1
logical name: usb1
version: 2.06
capabilities: usb-1.10
configuration: driver=hub slots=2 speed=12Mbit/s
Display Bridge information
To display information about bridge and related details, use bridge class.
# lshw -class bridge
*-pci
description: Host bridge
product: 440FX - 82441FX PMC [Natoma]
vendor: Intel Corporation
physical id: 100
bus info: pci@0000:00:00.0
version: 02
width: 32 bits
clock: 33MHz
*-isa
description: ISA bridge
product: 82371SB PIIX3 ISA [Natoma/Triton II]
vendor: Intel Corporation
physical id: 1
bus info: pci@0000:00:01.0
version: 00
width: 32 bits
clock: 33MHz
capabilities: isa
configuration: latency=0
*-bridge
description: Bridge
product: 82371AB/EB/MB PIIX4 ACPI
vendor: Intel Corporation
physical id: 1.3
bus info: pci@0000:00:01.3
version: 03
width: 32 bits
clock: 33MHz
capabilities: bridge
configuration: driver=piix4_smbus latency=0
resources: irq:9
To Display Display-information
To display information about display card details like VGA and related details, use display class.
# lshw -class display
*-display UNCLAIMED
description: VGA compatible controller
product: GD 5446
vendor: Cirrus Logic
physical id: 2
bus info: pci@0000:00:02.0
version: 00
width: 32 bits
clock: 33MHz
capabilities: vga_controller
configuration: latency=0
resources: memory:fc000000-fdffffff(prefetchable) memory:febd0000-febd0fff memory:febc0000-febcffff(prefetchable)
Display Generic information
Other hardware details will display under generic device (used when no pre-defined class is suitable).
# lshw -class generic
*-generic
description: Unclassified device
product: Virtio memory balloon
vendor: Red Hat, Inc
physical id: 5
bus info: pci@0000:00:05.0
version: 00
width: 32 bits
clock: 33MHz
capabilities: bus_master
configuration: driver=virtio-pci latency=0
resources: irq:10 ioport:c080(size=32)
Generate report in html/xml format
You can also export lshw reports in html, xml and json formats.
$ sudo lshw -html > lshw-output.html
For xml format
$ sudo lshw -xml > lshw-output.xml
lshw Man page
To know more about lshw command, navigate to man page.
# man lshw
