MDLog:/sysadmin

The Journal Of A Linux Sysadmin

Use Lshw (Hardware Lister) to Get Detailed Information on the Hardware Configuration of Your Linux System

| Comments

There are many ways you can find our various information about the hardware configuration of a Linux system. You can get the information directly from /proc, you can use lspci, etc. And if you are using X then there are many ways to show this information in a nice way. Still, I would like to show you the power of this little tool (lshw) that I found very useful if you are using a SSH connection to the system, and you want to get a quick overview on the hardware details of the system. LSHW can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc.

The installation is really simple, and you can find some details about installing lshw on Debian, or Rhel, Centos, or Fedora in the small posts I have written for this.

Once you have lswh installed on the system the usage is straightforth. Here is the short help listing:

Hardware Lister (lshw) - B.02.06
usage: lshw [-format] [-options ...]
lshw -version

-version        print program version (B.02.06)

format can be
-html           output hardware tree as HTML
-xml            output hardware tree as XML
-short          output hardware paths
-businfo        output bus information

options can be
-class CLASS    only show a certain class of hardware
-C CLASS        same as '-class CLASS'
-disable TEST   disable a test (like pci, isapnp, cpuid, etc. )
-enable TEST    enable a test (like pci, isapnp, cpuid, etc. )

Normally I am using this with the -short parameter to get a quick look on the hardware details of the system. It can output to html, or xml if you want that, and used without any parameters will list full details. Here is a sample output taken from a dual Xeon system, where for the sake of the example I have used the -short parameter:

lshw -short
H/W path                    Device     Class      Description
=============================================================
system     NCCH-DL
/0                                     bus        NCCH-DL
/0/0                                   memory     128KB BIOS
/0/4                                   processor  Intel(R) Xeon(TM) CPU 3.20GHz
/0/4/b                                 memory     16KB L1 cache
/0/4/d                                 memory     1MB L2 cache
/0/4/f                                 memory     L3 cache
/0/4/7.1                               processor  Logical CPU
/0/4/7.2                               processor  Logical CPU
/0/5                                   processor  Intel(R) Xeon(TM) CPU 3.20GHz
/0/5/c                                 memory     16KB L1 cache
/0/5/e                                 memory     1MB L2 cache
/0/5/10                                memory     L3 cache
/0/5/7.1                               processor  Logical CPU
/0/5/7.2                               processor  Logical CPU
/0/23                                  memory     2GB System Memory
/0/23/0                                memory     512MB DIMM DDR Synchronous
/0/23/1                                memory     512MB DIMM DDR Synchronous
/0/23/2                                memory     512MB DIMM DDR Synchronous
/0/23/3                                memory     512MB DIMM DDR Synchronous
/0/e0000000                            bridge     82875P/E7210 Memory Controller Hub
/0/e0000000/1                          bridge     82875P Processor to AGP Controller
/0/e0000000/1/0                        display    315PRO PCI/AGP VGA Display Adapter
/0/e0000000/1c                         bridge     6300ESB 64-bit PCI-X Bridge
/0/e0000000/1e                         bridge     82801 PCI Bridge
/0/e0000000/1e/9            scsi0      storage    MegaRAID
/0/e0000000/1e/9/1.0.0      /dev/sda   disk       68GB LD0 RAID1 70135R
/0/e0000000/1e/9/1.0.0/1    /dev/sda1  disk       Linux filesystem partition
/0/e0000000/1e/9/1.0.0/2    /dev/sda2  disk       Linux filesystem partition
/0/e0000000/1e/9/1.0.0/3    /dev/sda3  disk       Linux swap / Solaris partition
/0/e0000000/1e/9/1.0.0/4    /dev/sda4  disk       61GB Extended partition
/0/e0000000/1e/9/1.0.0/4/5  /dev/sda5  disk       Linux filesystem partition
/0/e0000000/1e/9/1.0.0/4/6  /dev/sda6  disk       Linux filesystem partition
/0/e0000000/1e/a            eth0       network    82557/8/9 [Ethernet Pro 100]
/0/e0000000/1f                         bridge     6300ESB LPC Interface Controller
/0/e0000000/1f.1                       storage    6300ESB PATA Storage Controller
/0/e0000000/1f.1/0          ide0       bus        IDE Channel 0
/0/e0000000/1f.1/0/0        /dev/hda   disk       149GB WDC WD1600BB-55GUC0
/0/e0000000/1f.1/0/0/1      /dev/hda1  disk       Linux filesystem partition
/0/e0000000/1f.3                       bus        6300ESB SMBus Controller

If you are using X then you might want to check also the nice front-end lswh provides (you will need to additionally install the lshw-gtk package on debian and lshw-gui on RHEL/Centos/Fedora).

For more details you can check the lshw project home page: http://ezix.org/project/wiki/HardwareLiSter

Comments