Finding out what hardware is in a box with lshw
January 4, 2011,
Sometimes you need to know what hardware is in a system, but you don't have specs, or you don't have access to the system. Being able to extract this information directly from the system would then be extremely useful, and this is exactly what lshw does.
Recently I was in the situation where I needed to upgrade the memory of a server, but I didn't have the specifications. In this particular case I had the option of opening up the box, getting the product codes from the memory modules, and doing a treasure hunt on Google to find the specifications, so I could order the correct modules. But of course in many cases this is not an option, for example because you don't have access to the system because it is in a data room. In that case lshw (hardware lister) is a very useful tool. It will provide you with a detailed listing of the hardware that is present in your system. With a few command line options you can control the output. For example, it is possible to export the specifications in XML, which might be handy for use in an inventory database.
Native packages are available for popular Linux distributions like Fedora and Ubuntu, so check your package utility first. Otherwize, sources can be downloaded from http://ezix.org/project/wiki/HardwareLiSter.