Wednesday, 3 September 2014

Useful hardware specific commands

dmidecode is an useful command like tool which can help in determining hardware information on a linux machine.

But, there are few specific commands which can help you to get more specific results. In this article we will see some of those hardware specific commands.

Command 1:
====
lscpu :
====

This command will help to get a detailed information about the CPU of a linux server.
=====
root@manoj [~]# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                    8
On-line CPU(s) list:   0-7
Thread(s) per core:    1
Core(s) per socket:    4
Socket(s):                     2
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                    23
Stepping:                10
CPU MHz:               2500.001
BogoMIPS:              4999.28
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              6144K
NUMA node0 CPU(s):     0-7
=====

Command 2: lshw
====
First of all download and install the following packages:
=======
wget http://ezix.org/software/files/lshw-B.02.14.tar.gz
 tar -zxvf lshw-B.02.14.tar.gz
 cd lshw-B.02.14
 make && make install
=======

Now you can use "lshw" command to get a complete detail of the hardware details.

Some options can be used along with this command which will help to get hardware details in much more readable format. 

"lshw -short" is one such example.

More useful Syntax of lshw are mentioned below:
===
lshw -short -class memory ===> Gives complete memory information of the system.
lshw -short -class disk ==> Gives the complete disk information of the system.
===

Example:
====
root@newserver [~]# lshw -short -class disk
H/W path              Device     Class      Description
=======================================================
/0/100/4/0/e/0.0.0    /dev/sda   disk       499GB SCSI Disk
/0/100/4/0/e/0.1.0    /dev/sdb   disk       249GB SCSI Disk
/0/100/4/0/e/0.2.0    /dev/sdc   disk       499GB SCSI Disk
/0/100/4/0/e/1.0.0                    disk       SCSI Disk
/0/100/4/0/e/1.1.0                    disk       SCSI Disk
/0/100/4/0/e/1.2.0                    disk       SCSI Disk
=====

lshw -html > hardware.html ==> This command will give the output to a html file.


Command 3:
====
hwinfo: This is same as lshw but gives a much more detailed description. 
====

First of all download and install the package.

For CentOS 6
=======
#rpm -Uvh http://mirror.symnds.com/distributions/gf/el/6/gf/x86_64/gf-release-6-6.gf.el6.noarch.rpm
#yum list hwinfo
#yum install hwinfo
=======

For Centos5:
========
#rpm -Uvh http://mirror.symnds.com/distributions/gf/el/5/gf/x86_64/gf-release-5-6.gf.el5.noarch.rpm
#yum list hwinfo
#yum install hwinfo
========


lshw --short will give a better description as below:
===========
root@manoj [/etc/yum.repos.d]# hwinfo --short
cpu:                                                            
                       Intel(R) Xeon(R) CPU           L5420  @ 2.50GHz, 2500 MHz
                       Intel(R) Xeon(R) CPU           L5420  @ 2.50GHz, 2500 MHz
                       Intel(R) Xeon(R) CPU           L5420  @ 2.50GHz, 2500 MHz
                       Intel(R) Xeon(R) CPU           L5420  @ 2.50GHz, 2500 MHz
                       Intel(R) Xeon(R) CPU           L5420  @ 2.50GHz, 2500 MHz
                       Intel(R) Xeon(R) CPU           L5420  @ 2.50GHz, 2500 MHz
                       Intel(R) Xeon(R) CPU           L5420  @ 2.50GHz, 2500 MHz
                       Intel(R) Xeon(R) CPU           L5420  @ 2.50GHz, 2500 MHz
mouse:
  /dev/input/mice      Macintosh mouse button emulation
graphics card:
                       XGI Volari Z7
storage:
                       Intel 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA AHCI Controller
                       Adaptec 3405
network:
  eth0                 Intel 82573L Gigabit Ethernet Controller
  eth1                 Intel 82573L Gigabit Ethernet Controller
network interface:
  lo                   Loopback network interface
  eth0                 Ethernet network interface
  eth1                 Ethernet network interface
disk:
  /dev/sda             Adaptec raid0
  /dev/sdb             Adaptec Device 1
  /dev/sdd             ST31000528AS
  /dev/sdc             Adaptec Device 2
partition:
  /dev/sda1            Partition
  /dev/sda2            Partition
  /dev/sda3            Partition
  /dev/sda4            Partition
  /dev/sdb1            Partition
  /dev/sdc1            Partition
  /dev/sdc2            Partition
usb controller:
                       Intel 82801I (ICH9 Family) USB UHCI Controller #4
                       Intel 82801I (ICH9 Family) USB2 EHCI Controller #2
                       Intel 82801I (ICH9 Family) USB UHCI Controller #1
                       Intel 82801I (ICH9 Family) USB UHCI Controller #2
                       Intel 82801I (ICH9 Family) USB UHCI Controller #3
                       Intel 82801I (ICH9 Family) USB2 EHCI Controller #1
bios:
                       BIOS
bridge:
                       Intel 5100 Chipset Memory Controller Hub
                       Intel 5100 Chipset PCI Express x8 Port 2-3
                       Intel 5100 Chipset PCI Express x16 Port 4-7
                       Intel 5100 Chipset FSB Registers
                       Intel 5100 Chipset FSB Registers
                       Intel 5100 Chipset FSB Registers
                       Intel 5100 Chipset Reserved Registers
                       Intel 5100 Chipset Reserved Registers
                       Intel 5100 Chipset DDR Channel 0 Registers
                       Intel 5100 Chipset DDR Channel 1 Registers
                       Intel 82801I (ICH9 Family) PCI Express Port 1
                       Intel 82801I (ICH9 Family) PCI Express Port 5
                       Intel 82801I (ICH9 Family) PCI Express Port 6
                       Intel 82801 PCI Bridge
                       Intel 82801IR (ICH9R) LPC Interface Controller
                       Intel 80333 Segment-A PCI Express-to-PCI Express Bridge
                       Intel 80333 Segment-B PCI Express-to-PCI Express Bridge
hub:
                       Linux 2.6.32-431.5.1.el6.x86_64 ehci_hcd EHCI Host Controller
                       Linux 2.6.32-431.5.1.el6.x86_64 ehci_hcd EHCI Host Controller
                       Linux 2.6.32-431.5.1.el6.x86_64 uhci_hcd UHCI Host Controller
                       Linux 2.6.32-431.5.1.el6.x86_64 uhci_hcd UHCI Host Controller
                       Linux 2.6.32-431.5.1.el6.x86_64 uhci_hcd UHCI Host Controller
                       Linux 2.6.32-431.5.1.el6.x86_64 uhci_hcd UHCI Host Controller
memory:
                       Main Memory
unknown:
                       FPU
                       DMA controller
                       PIC
                       Timer
                       Keyboard controller
                       Intel 5100 Chipset DMA Engine
                       Intel 82801I (ICH9 Family) SMBus Controller
  /dev/ttyS0           16550A
  /dev/ttyS1           16550A
  /dev/sg3             ST350041 8AS
  /dev/sg4             Samsung SSD
  /dev/sg5             ST350041 0AS
 ===========

Command 4:
======
lspci
=====
The lscpi command can list the information on the PCI bus, as well as all are connected to the PCI bus equipment information, such as the VGA adapter, SATA controller etc..

lspci tools is part of the pciutils package.so you need to install pciutils package then you can use lspci command.


Installation of packages can be done by using following command:
====
yum install pciutils
====

Command 5:
====
 lsusb- list bus information of usb
====

It can be installed via yum as below:
===
yum install usbutils
===

Example for usage of the command:
====
root@manoj [~]# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 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 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
=====


Command 6:
=====
lsblk- list the informaiton of block device
====

First install the packages:
=======
yum install util-linux-ng*
=======


Example:
=======
root@manoj [~]# lsblk
NAME                   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0                        7:0    0     4G  0 loop /tmp
sda                      8:0    1   465G  0 disk 
├─sda1                   8:1    1   512M  0 part /boot
├─sda2                   8:2    1     2G  0 part [SWAP]
├─sda3                   8:3    1     2G  0 part [SWAP]
└─sda4                   8:4    1 460.5G  0 part /
sdb                      8:16   1 232.7G  0 disk 
└─sdb1                   8:17   1 232.7G  0 part /mbrtest
sdd                      8:48   0 931.5G  0 disk 
sdc                      8:32   1   465G  0 disk 
├─sdc1                   8:33   1 116.4G  0 part 
└─sdc2                   8:34   1 348.6G  0 part 
  └─vg1-tetsvps (dm-0) 253:0    0   100G  0 lvm 
======

Command 6:
====
lsscsi
====

First install the package:
=====
yum install lsscsi*
=====

Example:
====
root@manoj[~]# lsscsi 
[0:0:0:0]    disk    Adaptec  raid0            V1.0  /dev/sda 
[0:0:1:0]    disk    Adaptec  Device 1         V1.0  /dev/sdb 
[0:0:2:0]    disk    Adaptec  Device 2         V1.0  /dev/sdc 
[0:1:0:0]    disk    ST350041 8AS              CC38  -       
[0:1:1:0]    disk    Samsung  SSD              7B0Q  -       
[0:1:2:0]    disk    ST350041 0AS              CC34  -       
[6:0:0:0]    disk    ATA      ST31000528AS     CC38  /dev/sdd 
=====






No comments:

Post a comment

Note: only a member of this blog may post a comment.