6 Examples To Get Linux Hardware Details / Information

Today in this article we are going to discuss about some tools and commands that might answer your questions like name of your motherboard’s chipset, NIC type, etc. Some of the tools are in built into any Linux system and others need to be downloaded.

Example 1: lspci command

This standard Linux utility shows what your systems have got internally. The command is combination of ls, the standard command to list files and PCI that is for the peripheral connection. You can also expect your results to include AGP and onboard components like your USB chipset.

The command is much helpful in diagnosing bugs related to PCI devices.Using -t option of lspci command you can see PCI layout in a tree format.

$ lspci -t

-[00]-+-00.0
+-02.0
+-1d.0
+-1d.1
+-1d.2
+-1d.7
+-1e.0-[01]–+-02.0
| +-02.1
| \-05.0
+-1f.0
+-1f.1
+-1f.3
\-1f.5

Above output displays all buses, bridges, devices and connections between them on your server or PC PCI bus. Here the master PCI bus is 00. To get more detailed information it is better to use -v option with -t option.

$ lspci -tv
Output:
-[00]-+-00.0 Intel Corporation 82845G/GL[Brookdale-G]/GE/PE DRAM Controller/Host-Hub Interface
+-02.0 Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device
+-1d.0 Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1

+-1d.1 Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2
+-1d.2 Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3
+-1d.7 Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller
+-1e.0-[01]–+-02.0 Brooktree Corporation Bt878 Video Capture
| +-02.1 Brooktree Corporation Bt878 Audio Capture
| \-05.0 Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+
+-1f.0 Intel Corporation 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge
+-1f.1 Intel Corporation 82801DB (ICH4) IDE Controller
+-1f.3 Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller
\-1f.5 Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC’97 Audio Controller

You can just run lspci command to display basic device information.

$ lspci
00:00.0 RAM memory: nVidia Corporation C51 Host Bridge (rev a2)
00:00.1 RAM memory: nVidia Corporation C51 Memory Controller 0 (rev a2)
00:00.2 RAM memory: nVidia Corporation C51 Memory Controller 1 (rev a2)
00:00.3 RAM memory: nVidia Corporation C51 Memory Controller 5 (rev a2)
00:00.4 RAM memory: nVidia Corporation C51 Memory Controller 4 (rev a2)
00:00.5 RAM memory: nVidia Corporation C51 Host Bridge (rev a2)
00:00.6 RAM memory: nVidia Corporation C51 Memory Controller 3 (rev a2)
00:00.7 RAM memory: nVidia Corporation C51 Memory Controller 2 (rev a2)
00:02.0 PCI bridge: nVidia Corporation C51 PCI Express Bridge (rev a1)
00:04.0 PCI bridge: nVidia Corporation C51 PCI Express Bridge (rev a1)
00:05.0 VGA compatible controller: nVidia Corporation C51 [GeForce 6150 LE] (rev a2)
00:09.0 RAM memory: nVidia Corporation MCP51 Host Bridge (rev a2)
00:0a.0 ISA bridge: nVidia Corporation MCP51 LPC Bridge (rev a3)
00:0a.1 SMBus: nVidia Corporation MCP51 SMBus (rev a3)

Example 2: hwinfo

The lspci command doesn’t provide any information about the hard disks, CPU, USB devices, etc. The hwinfo command probably does this. You can use hwinfo command with –short and –devicetype options to list a specific type of information.(where – is two hyphons). Hwinfo command mostly work on Ubuntu and other Debian based distros.

It was tested on CentOS and but you would need to compile. Below src rpm from OpenSuSe Repository could be used on CentOS 5.7

libx86emu-1.1-10.1.src.rpm
hwinfo-18.3-1.2.2.src.rpm

Display information about NIC cards and find out what eth0, eth1 stands for

# hwinfo –netcard –short
network:
eth0 Intel 82562V-2 10/100 Network Connection
eth1 D-Link DGE-528T Gigabit Ethernet Adapter
wlan0 Ralink 802.11 bg WLAN

Display storage information with hwinfo command.

# hwinfo –storage –short
storage:
Floppy disk controller
Intel 82801I (ICH9 Family) 2 port SATA IDE Controller
Intel 82801IR/IO/IH (ICH9R/DO/DH) 4 port SATA IDE Controller

Display list of partitions and hard disks.

# hwinfo –block –short
disk:
/dev/sdb WDC WD3200AAKS-7
/dev/sda SAMSUNG HD103UJ
partition:
/dev/sdb1 Partition
/dev/sdb2 Partition
/dev/sda1 Partition
cdrom:
/dev/sr1 TSSTcorp DVD+-RW TS-H653B
/dev/sr0 HL-DT-ST DVD-ROM GDRH20N

Below are some of the valid device types

cdrom
cpu
disk
ide
memory
netcard
partition
printer
scanner
scsi
gfxcard
sound
usb
wlan
bluetooth
monitor

Example 3: lshw

This tool is available in two forms: a command line version and a GTK graphical.

The lshw tool doesn’t come as inbuilt tool in most Redhat distributions. In order to use the tool you need to install it.

[root@fedora ~]# yum -y install lshw*

[root@fedora ~]# lshw | less
DMI
fedora.jmti.gov.my
description: Tower Computer
product: ProLiant ML570 G4
vendor: HP
serial: SGH7020LYP
width: 64 bits
capabilities: smbios-2.3 dmi-2.3 vsyscall64 vsyscall32
configuration: boot=hardware-failure-fw chassis=tower u
uid=34333030-3530-5347-4837-3032304C5950
*-core

Display disk properties and storage device properties on Linux system.

[root@redhat ~]# lshw -class disk -class storage
*-scsi:0
description: SCSI storage controller
product: AHA-3960D / AIC-7899A U160/m
vendor: Adaptec
physical id: 5
bus info: pci@0000:00:05.0
logical name: scsi2
version: 01
width: 64 bits
clock: 66MHz
capabilities: scsi pm bus_master cap_list scsi-host
configuration: driver=aic7xxx latency=64 maxlatency=25 mingnt=40 module=aic7xxx

*-storage
description: RAID bus controller
product: Smart Array 64xx
vendor: Compaq Computer Corporation
physical id: 4
bus info: pci@0000:02:04.0
version: 01
width: 64 bits
clock: 66MHz
capabilities: storage pm pcix vpd bus_master cap_list
configuration: driver=cciss latency=64 module=cciss

Example 4: dmesg

The dmesg command is useful to find out some info about hardware events. It displays the contents of the system log.

The command below lists all references to universal serial bus devices.

# dmesg | grep -i usb

The command below shows all serial ports.

# dmesg | grep -i tty

Display the details about physical memory that is RAM.

# dmesg | grep -i memory

Check whether HDD is running in DMA (direct memory access) mode

# dmesg | grep -i dma

Example 5: dmidecode command

dmidecode command can be used to display hardware and BIOS information

# dmidecode -t 4

where 4 represent DMI Type id and will give information about a particular hardware component of your system.

Below DMI Id can be used

Type Information
—————————————-
0 BIOS
1 System
2 Base Board
3 Chassis
4 Processor
5 Memory Controller
6 Memory Module
7 Cache
8 Port Connector
9 System Slots
10 On Board Devices
11 OEM Strings
12 System Configuration Options
13 BIOS Language
14 Group Associations
15 System Event Log
16 Physical Memory Array
17 Memory Device
18 32-bit Memory Error
19 Memory Array Mapped Address
20 Memory Device Mapped Address
21 Built-in Pointing Device
22 Portable Battery
23 System Reset
24 Hardware Security
25 System Power Controls
26 Voltage Probe
27 Cooling Device
28 Temperature Probe
29 Electrical Current Probe
30 Out-of-band Remote Access
31 Boot Integrity Services
32 System Boot
33 64-bit Memory Error
34 Management Device
35 Management Device Component
36 Management Device Threshold Data
37 Memory Channel
38 IPMI Device
39 Power Supply

Example 6: /proc command

/proc directory contains lots of system and hardware information. You can try below commands to get more info on devices.

$ procinfo

and

$ procinfo -a

cat /proc/cpuinfo
cat /proc/meminfo
cat /proc/pci

From: http://linoxide.com/linux-how-to/few-command-helps-to-get-linux-hardware-details/

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

Time limit is exhausted. Please reload CAPTCHA.