-
lshw command – List hardware information in Linux
Posted on February 23rd, 2009 No commentslshw is a Linux command which provides details of all the hardware in your PC. The details provided by the
lshwcommand run the gamut of processors, memory, slots, onboard sound, video chipset and more. To get the full details of your hardware, you need to runlshwcommand asroot(or super user). If you are using Ubuntu or any of its derivatives, you can run it usingsudoas follows :
$ sudo lshw
The output of
lshwcontain copious amounts of information about every aspects of your pc hardware. If you feel overwhelmed by the sheer amount of details, you can use the option-shortto get an abridged version of the output.$ sudo lshw -short
The output of the above lshw command on my machine is as follows :
H/W path Device Class Description ========================================================== system INTEL /0 bus DG31PR /0/0 memory 64KiB BIOS /0/4 processor Intel(R) Core(TM)2 Duo CPU E7300 @ 2.66GHz /0/4/5 memory 32KiB L1 cache /0/4/6 memory 3MiB L2 cache /0/4/1.1 processor Logical CPU /0/4/1.2 processor Logical CPU /0/22 memory 2GiB System Memory /0/22/0 memory 2GiB DIMM DDR Synchronous 800 MHz (1.2 ns) --- Truncated for brevity ---As you can see in the preceeding output,
lshwclassifies different parts of the hardware using classes. So if you want to see only the information related to a particular class such as memory, you can run the lshw command using the-classoption as follows :$ sudo lshw -class memory
… which will provide you detailed specifications about your computer’s memory and little else.
To get a list of all the classes identified by
lshw, you can execute it using the-businfooption.Get lshw output in multiple formats
lshw command provides output in multiple file formats. For example, you can get the output in HTML, XML, text and a few more.
For instance, to get the output in HTML, you use the-htmloption as follows :$ sudo lshw -html > hardware-info.html
… And it presents the output in a nice HTML format.
lshw GUI
The
lshwcommand also has an equivalent GUI which is available as thelshw-gtkpackage in Debian based Linux distributions. In Ubuntu, you can install lshw GUI as follows :$ sudo apt-get install lshw-gtk
This GUI tool provides all the details in a very user friendly and structured manner which any lay person can understand.
To sum up, identifying all the PC hardware in Linux such as processors, memory, chipset, audio and video is made easy using the
lshwcommand.Related Posts
- How to find large files in Linux using command line
- How to print a man page from the command line in Linux
- Chvt – Switch between Virtual Terminals – Linux Command
- pwd – Linux Command to Print Working Directory
- Search for files in Linux using the locate command


