Linux Command :: lshw


Bhaskar S 01/03/2015


Have you ever had the need to figure detailed information about one or more hardware components in your Desktop running Linux ???

If yes, there is help. The Linux lshw (List Hardware) command is a handy utility to extract detailed information on the various hardware components (such as CPU, Disk, Memory, Network, Video, etc) of the Desktop PC.

This command must to be run as a super user (sudo) to gather accurate information.

Let us go ahead and execute the lshw as follows:

$ sudo lshw -short

The following is the typical output:

Output.1

H/W path        Device      Class       Description
===================================================
                            system      GA-970A-UD3 ()
/0                          bus         GA-970A-UD3
/0/0                        memory      128KiB BIOS
/0/4                        processor   AMD FX(tm)-6300 Six-Core Processor
/0/4/a                      memory      128KiB L1 cache
/0/4/c                      memory      2MiB L3 cache
/0/b                        memory      128KiB L1 cache
/0/29                       memory      32GiB System Memory
/0/29/0                     memory      8GiB DIMM 1333 MHz (0.8 ns)
/0/29/1                     memory      8GiB DIMM 1333 MHz (0.8 ns)
/0/29/2                     memory      8GiB DIMM 1333 MHz (0.8 ns)
/0/29/3                     memory      8GiB DIMM 1333 MHz (0.8 ns)
/0/100                      bridge      RD890 PCI to PCI bridge (external gfx0 p
/0/100/2                    bridge      RD890 PCI to PCI bridge (PCI express gpp
/0/100/2/0                  display     Cedar [Radeon HD 5000/6000/7350/8350 Ser
/0/100/2/0.1                multimedia  Cedar HDMI Audio [Radeon HD 5400/6300 Se
/0/100/4                    bridge      RD890 PCI to PCI bridge (PCI express gpp
/0/100/4/0                  bus         EJ168 USB 3.0 Host Controller
/0/100/7                    bridge      RD890 PCI to PCI bridge (PCI express gpp
/0/100/7/0      wlan0       network     RTL8192CE PCIe Wireless Network Adapter
/0/100/9                    bridge      RD890 PCI to PCI bridge (PCI express gpp
/0/100/9/0      eth0        network     RTL8111/8168/8411 PCI Express Gigabit Et
/0/100/a                    bridge      RD890 PCI to PCI bridge (external gfx1 p
/0/100/a/0                  bus         EJ168 USB 3.0 Host Controller
/0/100/11                   storage     SB7x0/SB8x0/SB9x0 SATA Controller [IDE m
/0/100/12                   bus         SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
/0/100/12.2                 bus         SB7x0/SB8x0/SB9x0 USB EHCI Controller
/0/100/13                   bus         SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
/0/100/13.2                 bus         SB7x0/SB8x0/SB9x0 USB EHCI Controller
/0/100/14                   bus         SBx00 SMBus Controller
/0/100/14.1                 storage     SB7x0/SB8x0/SB9x0 IDE Controller
/0/100/14.2                 multimedia  SBx00 Azalia (Intel HDA)
/0/100/14.3                 bridge      SB7x0/SB8x0/SB9x0 LPC host controller
/0/100/14.4                 bridge      SBx00 PCI to PCI Bridge
/0/100/14.4/e               bus         VT6306/7/8 [Fire II(M)] IEEE 1394 OHCI C
/0/100/14.5                 bus         SB7x0/SB8x0/SB9x0 USB OHCI2 Controller
/0/100/15                   bridge      SB700/SB800/SB900 PCI to PCI bridge (PCI
/0/100/16                   bus         SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
/0/100/16.2                 bus         SB7x0/SB8x0/SB9x0 USB EHCI Controller
/0/101                      bridge      Family 15h Processor Function 0
/0/102                      bridge      Family 15h Processor Function 1
/0/103                      bridge      Family 15h Processor Function 2
/0/104                      bridge      Family 15h Processor Function 3
/0/105                      bridge      Family 15h Processor Function 4
/0/106                      bridge      Family 15h Processor Function 5
/0/1            scsi0       storage     
/0/1/0.0.0      /dev/sda    disk        256GB SanDisk SDSSDHP2
/0/1/0.0.0/1    /dev/sda1   volume      238GiB EXT4 volume
/0/2            scsi2       storage     
/0/2/0.0.0      /dev/cdrom  disk        DVD RW AD-7280S
/0/3            scsi4       storage     
/0/3/0.0.0      /dev/sdb    disk        1TB Hitachi HDS72101
/0/3/0.0.0/1    /dev/sdb1   volume      912GiB EXT4 volume
/0/3/0.0.0/2    /dev/sdb2   volume      18GiB Extended partition
/0/3/0.0.0/2/5  /dev/sdb5   volume      18GiB Linux swap / Solaris partition
/0/5            scsi5       storage     
/0/5/0.0.0      /dev/sdc    disk        1TB Hitachi HDS72101
/0/5/0.0.0/1    /dev/sdc1   volume      931GiB EXT4 volume
/0/6            scsi6       storage     
/0/6/0.0.0      /dev/sdd    disk        SCSI Disk
/0/6/0.0.1      /dev/sde    disk        SCSI Disk
/0/6/0.0.2      /dev/sdf    disk        SCSI Disk
/0/6/0.0.3      /dev/sdg    disk        SCSI Disk
/0/6/0.0.4      /dev/sdh    disk        SCSI Disk

The third column Class indicates the class of the hardware component.

The fourth column Description gives a short and brief description of the hardware component.

Now, to find information about the hardware class network, execute the following command:

$ sudo lshw -short -class network

The following is the typical output:

Output.2

H/W path        Device      Class       Description
===================================================
/0/100/7/0      wlan0       network     RTL8192CE PCIe Wireless Network Adapter
/0/100/9/0      eth0        network     RTL8111/8168/8411 PCI Express Gigabit Et

Hmm. What if we want more detailed information about the hardware class network ??? For that execute the following command (without the -short option):

$ sudo lshw -class network

The following is the typical output:

Output.3

  *-network               
       description: Wireless interface
       product: RTL8192CE PCIe Wireless Network Adapter
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: wlan0
       version: 01
       serial: xx:xx:xx:xx:xx:xx
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=rtl8192ce driverversion=3.13.0-37-generic firmware=N/A latency=0 link=no multicast=yes wireless=IEEE 802.11bgn
       resources: irq:19 ioport:de00(size=256) memory:fdbfc000-fdbfffff
  *-network
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:04:00.0
       logical name: eth0
       version: 06
       serial: xx:xx:xx:xx:xx:xx
       size: 100Mbit/s
       capacity: 1Gbit/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 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl8168e-3_0.0.4 03/27/12 ip=192.168.1.8 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s
       resources: irq:42 ioport:ce00(size=256) memory:fd6ff000-fd6fffff memory:fd6f8000-fd6fbfff

To find detailed information about the hardware class processor, execute the following command (without the -short option):

$ sudo lshw -class processor

The following is the typical output:

Output.4

  *-cpu                   
       description: CPU
       product: AMD FX(tm)-6300 Six-Core Processor
       vendor: Advanced Micro Devices [AMD]
       physical id: 4
       bus info: cpu@0
       version: AMD FX(tm)-6300 Six-Core Processor
       slot: Socket M2
       size: 1400MHz
       capacity: 1400MHz
       width: 64 bits
       clock: 200MHz
       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 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp x86-64 constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 popcnt aes xsave avx f16c lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 tce nodeid_msr tbm topoext perfctr_core perfctr_nb arat cpb hw_pstate npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold bmi1 cpufreq

To find detailed information about all the hardware in the Linux desktop, execute the following command (will generate a very long and detailed output):

$ sudo lshw

The following is the typical output (truncated):

Output.5

my-host
    description: Desktop Computer
    product: GA-970A-UD3 ()
    vendor: Gigabyte Technology Co., Ltd.
    width: 64 bits
    capabilities: smbios-2.4 dmi-2.4 vsyscall32
    configuration: boot=normal chassis=desktop uuid=35304535-3439-4330-3930-4245FFFFFFFF
  *-core
       description: Motherboard
       product: GA-970A-UD3
       vendor: Gigabyte Technology Co., Ltd.
       physical id: 0
       version: x.x
     *-firmware
          description: BIOS
          vendor: Award Software International, Inc.
          physical id: 0
          version: F8f
          date: 12/16/2013
          size: 128KiB
          capacity: 4032KiB
          capabilities: isa pci pnp upgrade shadowing cdboot bootselect socketedrom edd int13floppy360 int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer int10video acpi usb ls120boot zipboot biosbootspecification
     *-cpu
          description: CPU
          product: AMD FX(tm)-6300 Six-Core Processor
          vendor: Advanced Micro Devices [AMD]
          physical id: 4
          bus info: cpu@0
          version: AMD FX(tm)-6300 Six-Core Processor
          slot: Socket M2
          size: 1400MHz
          capacity: 1400MHz
          width: 64 bits
          clock: 200MHz
          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 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp x86-64 constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 popcnt aes xsave avx f16c lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 tce nodeid_msr tbm topoext perfctr_core perfctr_nb arat cpb hw_pstate npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold bmi1 cpufreq
        *-cache:0
             description: L1 cache
             physical id: a
             slot: Internal Cache
             size: 128KiB
             capacity: 128KiB
             capabilities: synchronous internal write-back
        *-cache:1
             description: L3 cache
             physical id: c
             slot: External Cache
             size: 2MiB
             capacity: 2MiB
             capabilities: synchronous internal write-back
     *-cache
          description: L1 cache
          physical id: b
          slot: Internal Cache
          size: 128KiB
          capacity: 128KiB
          capabilities: synchronous internal write-back
     *-memory
          description: System Memory
          physical id: 29
          slot: System board or motherboard
          size: 32GiB
        *-bank:0
             description: DIMM 1333 MHz (0.8 ns)
             physical id: 0
             slot: A0
             size: 8GiB
             width: 64 bits
             clock: 1333MHz (0.8ns)
        *-bank:1
             description: DIMM 1333 MHz (0.8 ns)
             physical id: 1
             slot: A1
             size: 8GiB
             width: 64 bits
             clock: 1333MHz (0.8ns)
        *-bank:2
             description: DIMM 1333 MHz (0.8 ns)
             physical id: 2
             slot: A2
             size: 8GiB
             width: 64 bits
             clock: 1333MHz (0.8ns)
        *-bank:3
             description: DIMM 1333 MHz (0.8 ns)
             physical id: 3
             slot: A3
             size: 8GiB
             width: 64 bits
             clock: 1333MHz (0.8ns)
... TRUNCATED ...

In short, lshw is a nifty command line tool that generates detailed information about the various hardware components of the Linux desktop.