Monday, March 1, 2010

How to find hardware information from command line on Linux



In this post you can see some useful command to find and show hardware information on Linux.

Default commands

ALL devices


dmesg will show you the kernel messages which can show you all the devices the kernel has found (hard disks,cdroms,etc)


# cat /proc/cpuinfo


# cat /proc/meminfo
$ free

PCI (including usb bridges,agp cards etc)

$ lspci

USB devices (mice,etc)

$ lsusb

Hard drives

# fdisk -l
$ df -h

Additional Command


lshw is a Linux command which provides details of all the hardware in your PC. The details provided by the lshw command run the gamut of processors, memory, slots, onboard sound, video chipset and more.
Install lshw

# pacman -S lshw

Debain, Ubuntu or any of its derivatives:
$ sudo aptitude install lshw

Redhat, fedora, CentOS:
# yum install lshw

# emerge lshw

Run lshw

# lshw
# lshw -short

To get the output in HTML, you use the -html option as follows:
# lshw -html > hardware-info.html

• See lshw command – List hardware information in Linux


dmidecode command reads the system DMI table to display hardware and BIOS information of the server. Apart from getting current configuration of the system, you can also get information about maximum supported configuration of the system using dmidecode. For example, dmidecode gives both the current RAM on the system and the maximum RAM supported by the system.
dmidecode is installed by default on many linux distribution like debain, ubuntu and fedora.
• See How To Get Hardware Information On Linux Using dmidecode Command

have a good time :)