Viewing Hardware Specifications with "lshw"
Linux Commands - Managing System and Program Info

Viewing Hardware Specifications with "lshw"

by Donnie Tevault

Sometimes, you can learn things by watching your Linux system perform an update. A few weeks ago, I was updating one of my Ubuntu systems, when I saw that "lshw" was one of the items that was getting updated. So, I pulled up its man page to see what it's about.

 

LSHW(1) LSHW(1)

NAME

lshw - list hardware

SYNOPSIS

lshw [ -version ]

lshw [ -help ]

lshw [ -X ]

lshw [ -html | -short | -xml | -businfo ] [ -class class ... ] [ -disable test ... ] [ -enable test

... ] [ -quiet ]

DESCRIPTION

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. on DMI-capable x86 or IA-64 systems and on some PowerPC machines (PowerMac G4 is known to work).

It currently supports DMI (x86 and IA-64 only), OpenFirmware device tree (PowerPC only), PCI/AGP, CPUID (x86), IDE/ATA/ATAPI, PCMCIA (only tested on x86), SCSI and USB.

. . .

. . .

 

Now, there are quite a few ways to look at system information, but lshw is a handy way to look at many things at once, and will give you information that other utilities won't.

 

Installation

If you're running an Ubuntu system, you don't have to do anything; it's already installed by default. On a Debian system, it's not installed, but it is in the normal Debian repositories. (There's also a GUI-interface, if you don't want to always use the command-line.)

 

Installing on Debian

 

If you're running a Red Hat-type system, such as CentOS, StartCom, Fedora, etc., you'll need to first install the Dag Wieers/rpmforge repository.

 

Dag Wieers/rpmforge

 

Then, use your favorite package manager to install lshw.

 

Installing on CentOS

 

What It Can Show You

 

"lshw" will show you lots of system information. We'll just look at a few example excerpts from its output.

Here, we're looking at the introductory information in the first stanza of output. This gives a general description of the system.

 

Opening stanza

 

Here, we're looking at information about the system's CPU.

 

Description of CPU

The terminology is a bit weird, with the way it outputs CPU speed as "size", but it still gets the right idea across.

 

Now, let's scroll down and look at memory information. You can see which slots are filled, and what kind of memory stick is in each slot. You can also see the total memory capacity of your motherboard.

 

Memory information

 

Actually, you'll get a few screens worth of information with just one command. You'll also see detailed information about drives, display adapters, network adapters, etc. (Note, also, that you'll need to use root privileges in order to see all available information.)

 

Why Use It?

 

There are a number of ways in which lshw can come in handy. You can use it for troubleshooting, to gather configuration information for compiling a kernel, or simply to gather information for performing a system upgrade. Use your imagination, and you just might come up with some other uses as well.