«

»

Feb 18

Getting Hardware Info on Linux

When you are trying to get hardware details for Linux machines, it seems very challenging at first but you have variety options and it is quiet easy. Some includes using custom scripts and existing resource folders(ex: dmesg, /proc) or by some applications like hwinfo and lshw.

In this article we will mention about different methods to get the hardware details from your Linux OS. These tips are mainly for Redhat, Suse and Debian and different distros might include little or more details for the hardware depending on the kernel levels.

1- Hardware Details on Linux using custom script:

This script will get almost everything you would need using existing messages or applications and give you a brief output.

It uses dmesg to get Memory Information
lspci for displaying information about all PCI buses in the system and all devices connected to them. By default, it shows a brief list of devices.
/proc/cpuinfo for CPU information (including cpu model, modelname (AMD Opteron(tm) Processor), Mhz (1992 Mhz)
fdisk -l –> For Hard drive and partition information
rpm -qa for the release info (mainly for Redhat) so you can remove this line for other distros.
/etc/*-release to get the Linux distro
uname -a to get the Linux Kernel level

#!/usr/bin/sh
rm  /tmp/outputecho "/n PCI info /n" >  /tmp/output
lspci >> /tmp/output
echo "/n Memory info /n" >>  /tmp/output /tmp/output
dmesg | grep -i memory >>  /tmp/output
echo "/n CPU info /n" >> /tmp/output
cat /proc/cpuinfo  /n" >>  /tmp/output
echo " HDD info /n" >>  /tmp/output
fdisk -l >>  /tmp/output
echo "/n " >>  /tmp/output
fdisk -l /dev/sdb* >> /tmp/output
echo "/n" >>  /tmp/output
fdisk -l /dev/hda* >> /tmp/output
echo "/n  Package info /n" >>  /tmp/output
rpm -qa >> /tmp/output
echo "/n Relese info /n" >> /tmp/output
cat /etc/*-release >> /tmp/output
echo "/n platform info /n" >> /tmp/output
uname -a >> /tmp/output

2- Hardware Details on Linux using tools (hwinfo, lshw):

There are different tools for different distros that you can use to get the hardware details.

On Suse, you can use: # hwinfo

You could hwinfo for Debians (apt-get hwinfo) very quickly too. It is very handy.
# hwinfo –short will give you a brief summary of your hardware

# hwinfo --short
cpu:
AMD Opteron(tm) Processor 246, 1992 MHz
AMD Opteron(tm) Processor 246, 1992 MHz
monitor:
Generic Monitor
graphics card:
ATI Rage XL
storage:
Floppy disk controller
AMD-8111 IDE
Silicon Image SiI 3114 SATALink Controller
network:
eth2                 Intel EtherExpress PRO/100 S Server Adapter
eth0                 Broadcom NetXtreme BCM5704 Gigabit Ethernet
eth1                 Broadcom NetXtreme BCM5704 Gigabit Ethernet
network interface:
lo                   Loopback network interface
eth0                 Ethernet network interface
eth1                 Ethernet network interface
eth2                 Ethernet network interface

On Debian, you can use: # lshw

# lshw -short will generate a summary output of your hardware list in a organized fashion.

H/W path            Device      Class      Description
======================================================
system     PowerEdge 1950
/0                              bus        0TT740
/0/0                            memory     64KiB BIOS
/0/400                          processor  Intel(R) Xeon(R) CPU           E5405  @ 2.00GHz
/0/400/700                      memory     128KiB L1 cache
/0/400/701                      memory     12MiB L2 cache
/0/400/702                      memory     L3 cache
/0/401                          processor  Intel(R) Xeon(R) CPU           E5405  @ 2.00GHz
/0/401/703                      memory     128KiB L1 cache
/0/401/704                      memory     12MiB L2 cache
/0/401/705                      memory     L3 cache
/0/1000                         memory     8GiB System Memory

3- Hardware Details on Linux using /proc folder:
You can get as many details as you like by just going under /proc folder and showing the contents of files. (# more meminfo)

# more meminfo
MemTotal:      8186420 kB
MemFree:         56572 kB
Buffers:        166008 kB
Cached:        4887080 kB
SwapCached:         12 kB
Active:        2886576 kB
Inactive:      4722968 kB
SwapTotal:     7807580 kB
SwapFree:      7807548 kB
Dirty:             220 kB
Writeback:           0 kB
AnonPages:     2556436 kB
Mapped:          35064 kB
Slab:           453328 kB
SReclaimable:   422408 kB
SUnreclaim:      30920 kB
PageTables:      11848 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:  11900788 kB
Committed_AS:  4229312 kB
VmallocTotal: 34359738367 kB
VmallocUsed:     27880 kB
VmallocChunk: 34359710403 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
HugePages_Surp:      0
Hugepagesize:     2048 kB

4- Listing DMI Table with dmidecode and USB devices with lsusb:

Another very effective and powerful tool is # dmidecode. dmidecode is a tool for dumping a computers DMI (some say SMBIOS) table contents in a human-readable format. This table contains a description of the systems hardware components, as well as other useful pieces of information such as serial numbers and BIOS revision.

# lsusb is the tool to show the devices attached to USB port even more.

if you use only # lsusb it will list the ports and what’s attached to it. If you use, lsusb with -v (verbose) you will get tons of info about USB ports.

# lsusb -v
Bus 002 Device 001: ID 0000:0000
Device Descriptor:
bLength                18
bDescriptorType         1
bcdUSB               1.10
bDeviceClass            9 Hub
bDeviceSubClass         0 Unused
bDeviceProtocol         0 Full speed hub
bMaxPacketSize0        64
idVendor           0x0000
idProduct          0x0000
bcdDevice            2.06
iManufacturer           3 Linux 2.6.18.2-34-default ohci_hcd
iProduct                2 OHCI Host Controller
iSerial                 1 0000:03:00.1
bNumConfigurations      1
Configuration Descriptor:
bLength                 9
bDescriptorType         2
wTotalLength           25
bNumInterfaces          1
bConfigurationValue     1
iConfiguration          0
bmAttributes         0xe0
Self Powered
Remote Wakeup
MaxPower                0mA
Interface Descriptor:
bLength                 9
bDescriptorType         4
bInterfaceNumber        0
bAlternateSetting       0
bNumEndpoints           1
bInterfaceClass         9 Hub
bInterfaceSubClass      0 Unused
bInterfaceProtocol      0 Full speed hub
iInterface              0
Endpoint Descriptor:
bLength                 7
bDescriptorType         5
bEndpointAddress     0x81  EP 1 IN
bmAttributes            3
Transfer Type            Interrupt
Synch Type               None
Usage Type               Data
wMaxPacketSize     0x0002  1x 2 bytes
bInterval             255

1 ping

  1. Probe hardware info on SUSE Linux « teleedu

    […] Getting Hardware Info on Linux Suse Debian Redhat Ubuntu. Share this:TwitterFacebookLike this:LikeBe the first to like this post. Categories: OS, unix Comments (0) Trackbacks (0) Leave a comment Trackback […]

Leave a Reply