Sunday, April 18, 2010

Getting to know the hardware of your Linux box

SkyHi @ Sunday, April 18, 2010
When you buy a new PC, laptop or server and install a Linux you want to know what hardware is actually in the Linux box and more importantly which piece of hardware is supported by the kernel out of the box and which needs special tweaking with modules to get it work. Here is a list of commands which should help you to troubleshoot your hardware and find some information about it. This is not a ultimate troubleshooting guide but certainly will serve as a good starting point.
NOTE: some commands may not be avaiable for your platform after default installation as well as some commands may be distribution specific only.

1. What hardware is in my Linux box:

$ lspci
or
# dmidecode

2. What hardware is using which module.

NOTE:Root permissions are needed to execute this command:
# lspci -v
or
# lspci -vvv
or
# hardinfo
or
$ hardinfo ( GUI )
or
# lshw
or
# lshw-gtk  ( GUI )
or
# hwinfo

3. BIOS

Retrieve BIOS information:
# biosdecode
Retrieve BIOS vendor information:
# dmidecode -s  bios-vendor

4. Retrieve information about your motherboard only:

# dmidecode --type baseboard

5. What USB devices are plugged in:

$ lsusb

6. Get USB disk device files

ls -la /dev/disk/by-id/usb-*

7. Hard drive model

hdparm -I /dev/sdx

8. Hard drive speed

hdparm -tT /dev/sdx

9. Graphic card information:

$ lspci | grep VGA

10. Check the size of the hard drive and partitions

Check the size of the hard drive and what hard drives are available in the system.
This command will also list USB drives and sticks. You need a root permissions to execute this command:
# fdisk -l | grep GB
Check what partitions and file system is in use on my hard drives:
# fdisk -l

11. Locate CD/DVD-ROM device file:

$ wodim --devices
or
$ wodim --scanbus

12. Modules

What modules are currently loaded:
$ lsmod
get a information about any particular module:
$ /sbin/modinfo module_name
remove modules:
# modprobe --remove module_name
load a modules to the kernel:
# modprobe module_name
What hardware is using which module.
NOTE:Root permissions are needed to execute this command:
# lspci -v
or
# lspci -vvv

13. Check for PCMCIA cards:

# lspcmcia

14. Processor type and socket

$ cat /proc/cpuinfo
or
# dmidecode --type 4
Is my processor using 32 or 64 bit instruction set:
$ cat /proc/cpuinfo | grep flags | grep lm
if you get some output you have 64 bit if no output is presented you are using 32 or even 16 bit CPU. NOTE: grep command looks for lm flag.
Retrieve CPU / Processor socket type:
x86info -a 2> /dev/null | grep Connector | uniq

15. RAM

How much RAM is installed in my Linux and how much of it is in use ( mega bytes ).
It will also include swap memory:
$ free -m
or
$ top
or
$ cat /proc/meminfo
Detect number of RAM slots used, speed, and size:
# lshw -C memory -short
or
# dmidecode -t 17

16. Sound Card

Check sound card settings. This command will reveal whether your sound card is installed and what modules are in use:
$ cat /dev/sndstat

17. Available wireless cards:

$ iwconfig

18. What speed is set to FANs:

$  cat /proc/acpi/ibm/fan

19. Battery

Get a battery information on your laptop:
$ powersave -b

20. List Plug and Play BIOS device

# lspnp
 
REFERENCE
http://www.linuxconfig.org/getting-know-a-hardware-on-your-linux-box