Don’t you hate when you need to know and exact model of a specific hardware component but don’t want to open up the machine or find the original documentation on it? Never fear, Linux has you covered.
There are a variety of ways to find out what kind of hardware you’re running, but one of the easiest ways that gives you large amounts of valuable data is to use
lshw (Hardware Lister). I’m running Ubuntu 8.10 (Intrepid Ibex), and lshw is installed by default. You can test if you have lshw installed on you system by running the following command:
[chris@home ~]$ sudo lshw
If you get a large listing spewed out on your terminal, you’re good to go. Skip down to the Using lshw section. If you run the lshw command and get a “bash: lshw: command not found” error, you should be able to install lshw using your system’s package manager easily.
lshw is available on most package management systems.
If you use APT (Debian-based distros: Ubuntu, Linux Mint, and others), run the following command in terminal:
[chris@home ~]$ sudo apt-get install lshw
If you use Yum (Red Hat, Fedora, CentOS, Yellow Dog Linux, etc), run the following command in terminal:
[chris@home ~]$ sudo yum install lshw
If these instructions don’t match your package manager, look for specific instructions on the lshw site to get it installed on your system.
If you just run lshw by itself on the command line, your screen will be flooded with large amounts of text. Fortunately, it is very easy to get lshw to give you output that meets your needs.
If you just quickly want to quickly find the chipset version of a piece of hardware is, you can run the following to provide a very short output that should give you what you need:
[chris@home ~]$ sudo lshw -short
For example, here is a sample when I run this on my Dell Studio 17 laptop (Note: I’ve removed a large portion of the output to make this fit):
[chris@home ~]$ sudo lshw -short Device Class Description ===================================== system Studio 1735 bus 0H275K memory 64KiB BIOS processor Intel(R) Core(TM)2 Duo CPU T8100 @ 2.10GHz memory 32KiB L1 cache memory 3MiB L2 cache memory 4GiB System Memory memory 2GiB DIMM DDR Synchronous 667 MHz (1.5 ns) memory 2GiB DIMM DDR Synchronous 667 MHz (1.5 ns) display Mobility Radeon HD 3650 multimedia RV635 Audio device [Radeon HD 3600 Series] multimedia 82801H (ICH8 Family) HD Audio Controller eth1 network BCM4322 802.11a/b/g/n Wireless LAN Controller eth0 network NetLink BCM5784M Gigabit Ethernet PCIe /dev/sda disk 250GB WDC WD2500BEVS-7
This of course leaves out a lot of detail. Maybe we just need to store the data somewhere so it’s easier to work with.
Storing Output to a File
If you’d like to put all the lshw output into a file, you can do so easily from the terminal with output redirection.
[chris@home ~]$ sudo lshw > hardware.txt
This will run the lshw command and put all the output into a file in the current directory called hardware.txt. Note that this will replace any file in the current directory called hardware.txt. Make sure that you either backup the file, give the output file a unique name, or are prepared to lose that original file’s information.
Now you can open the hardware.txt file with your favorite editor and look through the informations.
Creating HTML or XML Output
lshw has the ability to format its output in either HTML or XML. This can be very helpful if you want to post your hardware specs somewhere online to be viewed or to send the data to a storage system.
To create HTML output, simply give lshw the
[chris@home ~]$ sudo lshw -html > hardware.html
This will format the output into a HTML document and save the output in a file called hardware.html.
Creating XML is done with the
[chris@home ~]$ sudo lshw -xml > hardware.xml
Like before, this will output the document in XML format and save it to hardware.xml.
lshw is a fantastic tool to quickly and easily find out what hardware is running on your system. Not only that, it can provide output can be given to others when you ask for help about the hardware on your system.
I saved the HTML output for my Dell Studio 17 system. You can see it here.
Did I help you?