Hardware Discovery with Linux

I have a very old IBM Thinkpad that has Linux installed on it, and I wanted to know what hardware it had. Thanks to my Linux mailing list for a couple commands I wasn't already familiar with. What you'll use for this depends on what you're looking for, but the single best overall command seems to be lshw. There are several caveats here: the first being it's not installed by default on Debian (apt-get install lshw will take care of that if you have a network connection). It's very slow too: on a 500 MHz P3 it took 17 seconds (on a couple year old i7 system it still took 3 seconds). And it produces very ugly and long output (200-400 lines - might want to pipe it to less). But it's pretty thorough: the only thing I was vaguely interested in that I had to go elsewhere for was the hard drive model (not the manufacturer, just the model - it provided the "vendor"). The most notable lack is that this won't provide any information about the screens attached to the machine, either the permanently attached one (I'm working with laptops) or external ones, although it will tell you about the video card(s).


xdpyinfo - again, ugly and long output, but the information is generally there. I think there's a caveat here, being that it will only tell you about SUPPORTED hardware.


This is fairly easy: free provides total, used, and "free" memory. It also provides the same information for your swap partition(s).

Hard Drives

My favourite command for this is fdisk -l (must be run as root), which provides extensive information about any installed HD, partition numbering, sizes, and types. parted -l is probably better because it understands GPT (fdisk doesn't, but does seem to report okay anyway). What neither provides is labels. For that I generally use blkid. Also useful is lsblk - it still doesn't provide labels, but it's not as ugly as fdisk -l: in fact, it's the most concise, provides mountpoints, and is the one to go to if you need major/minor device numbers. If you want way too much information, run smartctl -x /dev/sda (or whatever drive you want to know about). Shorter information about the hardware details can be found from hdparm -i /dev/sda .

For more detail about storage devices, see Storage Device Partition Discovery.


On Debian, the "lm-sensors" package provides the sensors command, which can (usually - system-dependent) tell you about the temperature of your processor cores and your video card.

Other Sources

dmesg or less /var/log/dmesg can provide some information about hardware, and may contain some surprises about your start-up: error messages you didn't even know existed, likely to jolt you out of your blissful ignorance. lspci and lsusb will both list devices for their particular bus - including the hubs you didn't realize you have but that are necessary to the functioning of your computer. lscpu provides a fair bit of useful information in a readable short form, but the major bit missing is the processor model ("Vendor" is provided - so on the Thinkpad that started this it told me it was Intel, 32-bit, and it was 500 MHz ... but it didn't tell me that it was a PIII. Which is an important distinction: it could have been a Celeron. I know I could figure it out from the L1 and L2 caches and probably from the model number, but a clearer statement is helpful.

dmidecode provides roughly 600 lines of particularly obscure information relating to BIOS devices (technically "SMBIOS" or "System Management BIOS," and "DMI" is "Desktop Management Interface" - not that either of those things helped me much). Some of this is useful, but it's generally accessible from other, more readable sources.