Did you ever find that you did not remember exactly what hardware you installed on your computer? Well, that happened to me just now. I had a situation about 6 months ago where I was trying to build a computer and things were going wrong. After buying various replacement parts and not fixing the situation, I finally took everything to a local shop and had them fix it. They did, but mostly by installing the motherboard and processor they wanted to use. I got a great computer out of it, so I am not complaining, but I had this stack of hardware left over. I thought I would see what I could use in replacing an older computer that is starting to look pretty long in the tooth. As I pulled out various boxes, I found thing like an ASUS motherboard in a Gigabyte box. But does that mean the Gigabyte motherboard was installed somewhere? And if so, where? I suppose I could start opening up cases, but the current issue (August 2010) of Linux Journal has an article entitled “What Hardware Do I Have?”, which seemed perfect. So I thought I would try it out.
The first command they recommended is lshw. This command LiSts HardWare, as you might suspect. You can run this as a normal user, but it warns you that you really ought to have root priviliges when you run it. The output is immense, but here are the first few sections:
kevin@kimball:~$ sudo lshw
[sudo] password for kevin:
kimball
description: Desktop Computer
product: GA-MA785GT-UD3H
vendor: Gigabyte Technology Co., Ltd.
width: 64 bits
capabilities: smbios-2.4 dmi-2.4 vsyscall64 vsyscall32
configuration: boot=normal chassis=desktop uuid=30303234-3144-3846-4339-4232FFFFFFFF
*-core
description: Motherboard
product: GA-MA785GT-UD3H
vendor: Gigabyte Technology Co., Ltd.
physical id: 0
version: x.x
*-firmware
description: BIOS
vendor: Award Software International, Inc.
physical id: 0
version: F1 (07/03/2009)
size: 128KiB
capacity: 960KiB
So, I definitely found my Gigabyte motherboard. The next section told me my CPU:
*-cpu
description: CPU
product: AMD Athlon(tm) II X2 240 Processor
vendor: Advanced Micro Devices [AMD]
physical id: 4
bus info: cpu@0
version: AMD Athlon(tm) II X2 240 Processor
slot: Socket M2
size: 800MHz
capacity: 3GHz
width: 64 bits
clock: 200MHz
So far, so good. But suppose you wanted more information about your CPU. You could try the lscpu command:
kevin@kimball:~$ sudo lscpu
Architecture: x86_64
CPU op-mode(s): 64-bit
CPU(s): 2
Thread(s) per core: 1
Core(s) per socket: 2
CPU socket(s): 1
NUMA node(s): 1
Vendor ID: AuthenticAMD
CPU family: 16
Model: 6
Stepping: 2
CPU MHz: 800.000
Virtualization: AMD-V
L1d cache: 64K
L1i cache: 64K
L2 cache: 1024K
And for the video card try lspci, which gives info on all devices plugged in to the PCI bus.
01:05.0 VGA compatible controller: ATI Technologies Inc RS880 [Radeon HD 4200]
In this case, it is picking up the onboard video because I didn’t need anything more than that. I just play music and video podcasts downloaded from the Internet, so there was no good reason to invest in a video card.
To look at USB devices, try (what else?) lsusb:
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 0d3d:0001 Tangtop Technology Co., Ltd HID Keyboard
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 050d:0234 Belkin Components F5U234 USB 2.0 4-Port Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
For hard drives and other block devices, use blkid:
/dev/sda1: UUID="2c395ab8-1a12-4ce1-94d6-38942a6fadc6" TYPE="ext4"
/dev/sda5: UUID="1fb964d6-6c0e-4b89-bc05-eef44ae1397a" TYPE="ext4"
/dev/sda6: UUID="5205a37e-bab5-4db8-9e75-1ce70f8059db" TYPE="ext4"
/dev/sda7: UUID="1a021347-4e03-40fb-84c6-44c306e02c0c" TYPE="swap"
/dev/sdb1: UUID="750d70ef-74bc-4fbd-8a3b-21fc8f1cb5a0" TYPE="ext4"
You can see that my first hard drive has 3 data partitions and a swap partition, and I have second drive configured as one large partition. That is pretty standard for me, so I saw what I expected to see. I usually configure my first hard drive to have a root partition (/), a /var partition, and the rest as /home. Then the second drive is set up as /data.
The last thing to look at is whether your kernel is using all of this lovely hardware. The kernel uses hardware by using kernel modules, so you can see those modules using lsmod:
kevin@kimball:~$ sudo lsmod
Module Size Used by
binfmt_misc 7960 1
ppdev 6375 0
vboxdrv 1792375 0
snd_hda_codec_atihdmi 3023 1
snd_hda_codec_realtek 279040 1
fbcon 39270 71
tileblit 2487 1 fbcon
font 8053 1 fbcon
bitblit 5811 1 fbcon
softcursor 1565 1 bitblit
snd_hda_intel 25677 5
snd_hda_codec 85759 3 snd_hda_codec_atihdmi,snd_hda_codec_realtek,snd_hda_intel
snd_hwdep 6924 1 snd_hda_codec
snd_pcm_oss 41394 0
snd_mixer_oss 16299 1 snd_pcm_oss
vga16fb 12757 0
vgastate 9857 1 vga16fb
snd_seq_dummy 1782 0
snd_pcm 87882 3 snd_hda_intel,snd_hda_codec,snd_pcm_oss
snd_seq_oss 31219 0
snd_seq_midi 5829 0
snd_rawmidi 23420 1 snd_seq_midi
snd_seq_midi_event 7267 2 snd_seq_oss,snd_seq_midi
snd_seq 57481 7 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_seq_midi_event
snd_timer 23649 2 snd_pcm,snd_seq
snd_seq_device 6888 5 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_rawmidi,snd_seq
radeon 740390 2
ttm 60847 1 radeon
drm_kms_helper 30742 1 radeon
snd 71106 23 snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_seq_oss,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
soundcore 8052 1 snd
drm 199204 4 radeon,ttm,drm_kms_helper
i2c_algo_bit 6024 1 radeon
snd_page_alloc 8500 2 snd_hda_intel,snd_pcm
i2c_piix4 9639 0
edac_core 45423 0
shpchp 33711 0
edac_mce_amd 9278 0
psmouse 64576 0
serio_raw 4918 0
lp 9336 0
parport 37160 2 ppdev,lp
usbhid 41084 0
hid 83440 1 usbhid
ohci1394 30260 0
ieee1394 94771 1 ohci1394
ahci 37838 5
pata_atiixp 4209 0
r8169 39650 0
mii 5237 1 r8169
So, there you have it. And thanks to Linux Journal for putting all of this together. If you do not have a subscription to Linux Journal, you might want to get one. They frequently have useful articles like this