Quoting the manual:
lshw is a small tool to extract detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc.
The command searches for information in operating system files, including but not limited to those available in the /proc directory.
Installation
In Slackware it is possible to install from slackbuilds or using the sbpkg installation utility.
# Shell
// Slackware sbopkg -i lshw // ubuntu, debian sudo apt-get install lshw // fedora, centos (epel) sudo yum install lshw
The lshw command needs to be run with administrator permissions, use the root user or the sudo command. Lshw classifies hardware components into classes: Processor, memory, display, network, storage, bridge, multimedia and others.
Basic usage
Running the command lshw without any options will return all information for all detected hardware. A lot of information will be generated.
# Shell
lshw
homer
description: Notebook
product: HP Pavilion Sleekbook 14 PC (C1C39LA#AC4)
vendor: Hewlett-Packard
version: 088C100000355900000310100
serial: BRG301F37S
width: 4294967295 bits
capabilities: smbios-2.7 dmi-2.7 smp vsyscall32
configuration: boot=normal chassis=notebook family=103C_5335KV G=N L=CON B=HP S=PAV X=Null sku=C1C39LA#AC4 uuid=42524733-3031-4633-3753-38EAA7D233FB
*-core
description: Motherboard
product: 18FA
vendor: Hewlett-Packard
physical id: 0
version: 82.27
serial: PDJWD0AEP3U0AG
slot: Type2 - Board Chassis Location
*-memory
description: System Memory
physical id: 0
slot: System board or motherboard
size: 8GiB
... interrupted...
Leaving it short
Using the -short parameter is a way to view the most relevant information, generating an overview of hardware devices.
# Shell
lshw -short
H/W path Device Class Description
=================================================
system HP Pavilion Sleekbook 14 PC (C1C39LA#AC4)
/0 bus 18FA
/0/0 memory 8GiB System Memory
/0/0/0 memory 4GiB SODIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/0/1 memory 4GiB SODIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/9 memory 128KiB BIOS
/0/20 processor Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz
/0/20/22 memory 32KiB L1 cache
/0/20/23 memory 256KiB L2 cache
/0/20/24 memory 3MiB L3 cache
/0/21 memory 32KiB L1 cache
/0/100 bridge 3rd Gen Core processor DRAM Controller
/0/100/2 display 3rd Gen Core processor Graphics Controller
/0/100/14 bus 7 Series/C210 Series Chipset Family USB xHCI Host Controller
/0/100/16 communication 7 Series/C210 Series Chipset Family MEI Controller #1
/0/100/1a bus 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2
/0/100/1b multimedia 7 Series/C210 Series Chipset Family High Definition Audio Controller
/0/100/1c bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 1
/0/100/1c/0 wlan0 network RT3290 Wireless 802.11n 1T/1R PCIe
/0/100/1c/0.1 generic RT3290 Bluetooth
/0/100/1c.1 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 2
/0/100/1c.1/0 eth0 network RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller
/0/100/1c.2 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 3
/0/100/1c.2/0 generic RTS5229 PCI Express Card Reader
/0/100/1d bus 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1
/0/100/1f bridge HM77 Express Chipset LPC Controller
/0/100/1f.2 storage 82801 Mobile SATA Controller [RAID mode]
/0/100/1f.3 bus 7 Series/C210 Series Chipset Family SMBus Controller
/1 power VK04037
The result above reveals that this hardware belongs to an HP Pavilion Sleekbook, with 8 GB of memory divided into two slots each with 4 GB. The processor is an Intel with 1.80GHz, it has a wireless card, bluetooth, a network card, some USB ports, etc.
The third column is the class name and you can request specific hardware information using the -class parameter followed by the class name.
Memory
To display information about memory, use the memory class.
# Shell
lshw -short -class memory
H/W path Device Class Description
=================================================
/0/0 memory 8GiB System Memory
/0/0/0 memory 4GiB SODIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/0/1 memory 4GiB SODIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/9 memory 128KiB BIOS
/0/20/22 memory 32KiB L1 cache
/0/20/23 memory 256KiB L2 cache
/0/20/24 memory 3MiB L3 cache
/0/21 memory 32KiB L1 cache
Processor
Run lshw without the -short parameter and with the processor class to display complete CPU information.
# Shell
lshw -class processor
*-cpu
description: CPU
product: Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz
vendor: Intel Corp.
physical id: 20
bus info: cpu@0
version: Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz
serial: To Be Filled By O.E.M.
slot: U3E1
size: 1776MHz
capacity: 4GHz
width: 64 bits
clock: 100MHz
capabilities: x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx f16c lahf_lm ida arat epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt cpufreq
configuration: cores=2 enabledcores=2 threads=4
The lscpu command returns additional information about the processor. See also: Commands to get information from the machine's hardware in Linux.
Disk drives
Use the disc class.
# Shell
lshw -short -class disk
H/W path Device Class Description
==================================================
/0/0/0.0.0 /dev/sda disk 500GB WDC WD5003ABYX-1
/0/1/0.0.0 /dev/cdrom disk DVD-ROM SN-108BB
To show information about partitions and controllers, specify the storage and volume classes together with the disc class.
# Shell
lshw -short -class disk -class storage -class volume
H/W path Device Class Description
==================================================
/0/100/1f.2 storage 6 Series/C200 Series Chipset Family SATA AHCI Controller
/0/0 scsi0 storage
/0/0/0.0.0 /dev/sda disk 500GB WDC WD5003ABYX-1
/0/0/0.0.0/1 /dev/sda1 volume 39MiB Windows FAT volume
/0/0/0.0.0/2 /dev/sda2 volume 2GiB Windows FAT volume
/0/0/0.0.0/3 /dev/sda3 volume 94MiB Linux filesystem partition
/0/0/0.0.0/4 /dev/sda4 volume 463GiB Extended partition
/0/0/0.0.0/4/5 /dev/sda5 volume 7812MiB Linux swap volume
/0/0/0.0.0/4/6 /dev/sda6 volume 9766MiB Linux filesystem partition
/0/0/0.0.0/4/7 /dev/sda7 volume 9766MiB Linux filesystem partition
/0/0/0.0.0/4/8 /dev/sda8 volume 19GiB Linux filesystem partition
/0/0/0.0.0/4/9 /dev/sda9 volume 47GiB Linux filesystem partition
/0/0/0.0.0/4/a /dev/sda10 volume 19GiB Linux filesystem partition
/0/0/0.0.0/4/b /dev/sda11 volume 19GiB Linux filesystem partition
/0/0/0.0.0/4/c /dev/sda12 volume 264GiB Linux filesystem partition
/0/0/0.0.0/4/d /dev/sda13 volume 67GiB Linux filesystem partition
/0/1 scsi4 storage
/0/1/0.0.0 /dev/cdrom disk DVD-ROM SN-108BB
Network adapter
Run the lshw command without the -short parameter and with the network class to display detaild information about network adapters.
# Shell
lshw -class network
*-network
description: Ethernet interface
product: RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:02:00.0
logical name: eth0
version: 05
serial: 38:ea:a7:d2:33:fb
size: 100Mbit/s
capacity: 100Mbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl_nic/rtl8105e-1.fw ip=192.168.88.10 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s
resources: irq:29 ioport:3000(size=256) memory:52404000-52404fff memory:52400000-52403fff
The output shows MAC Address, autonegociation, speed and more.
Address details
Use businfo class to consult address details of pci, usb, scsi and ide devices.
# Shell
lshw -businfo
Bus info Device Class Description
====================================================
system PowerEdge R210 II
bus 0JP7TR
cpu@0 processor Intel(R) Xeon(R) CPU E3-1220 V2 @ 3.10GHz
memory 32KiB L1 cache
memory 1MiB L2 cache
memory 8MiB L3 cache
memory 32KiB L1 cache
memory 64KiB BIOS
memory 4GiB System Memory
memory DIMM DDR3 [empty]
memory 4GiB DIMM DDR3 Synchronous Unbuffered (Unregistered) 1333 MHz (0.8 ns)
memory DIMM DDR3 [empty]
memory DIMM DDR3 [empty]
pci@0000:00:00.0 bridge Xeon E3-1200 v2/Ivy Bridge DRAM Controller
pci@0000:00:1a.0 bus 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2
pci@0000:00:1c.0 bridge 6 Series/C200 Series Chipset Family PCI Express Root Port 1
pci@0000:01:00.0 eth0 network NetXtreme II BCM5716 Gigabit Ethernet
pci@0000:01:00.1 eth1 network NetXtreme II BCM5716 Gigabit Ethernet
pci@0000:00:1d.0 bus 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1
pci@0000:00:1e.0 bridge 82801 PCI Bridge
pci@0000:02:03.0 display MGA G200eW WPCM450
pci@0000:00:1f.0 bridge C202 Chipset Family LPC Controller
pci@0000:00:1f.2 storage 6 Series/C200 Series Chipset Family SATA AHCI Controller
pci@0000:00:1f.3 bus 6 Series/C200 Series Chipset Family SMBus Controller
scsi0 storage
scsi@0:0.0.0 /dev/sda disk 500GB WDC WD5003ABYX-1
scsi@0:0.0.0,1 /dev/sda1 volume 39MiB Windows FAT volume
scsi@0:0.0.0,2 /dev/sda2 volume 2GiB Windows FAT volume
scsi@0:0.0.0,3 /dev/sda3 volume 94MiB Linux filesystem partition
scsi@0:0.0.0,4 /dev/sda4 volume 463GiB Extended partition
/dev/sda5 volume 7812MiB Linux swap volume
/dev/sda6 volume 9766MiB Linux filesystem partition
/dev/sda7 volume 9766MiB Linux filesystem partition
/dev/sda8 volume 19GiB Linux filesystem partition
/dev/sda9 volume 47GiB Linux filesystem partition
/dev/sda10 volume 19GiB Linux filesystem partition
/dev/sda11 volume 19GiB Linux filesystem partition
/dev/sda12 volume 264GiB Linux filesystem partition
/dev/sda13 volume 67GiB Linux filesystem partition
scsi4 storage
scsi@4:0.0.0 /dev/cdrom disk DVD-ROM SN-108BB
eth1.10 network Ethernet interface
Reports in html/xml/json
Lshw is capable of providing hardware reports in html, xml and json.
# Shell
// HTML lshw -html > hardware.html // XML lshw -xml > hardware.xml // JSON lshw -json > hardware.json