Top 5 Commands to show Hardware Inventory Information in Linux
1.lshw (list hardware)
DESCRIPTION
lshw is a small tool to extract detailed information on the hardware configuration of the machine. It can
report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache
configuration, bus speed, etc. on DMI-capable x86 or IA-64 systems and on some PowerPC machines (PowerMac
G4 is known to work).
Syntax:
lshw [options]
Popular options
lshw -short
lshw -html
lshw -xml
lshw -sanitize
lshw -c network
Installation:
Debian/Ubuntu:
sudo apt install lshw
Redhat/CentOS/Fedora
yum install lshw
dnf install lshw
Sample Output:
tux@labucs1:~$ lshw -short
WARNING: you should run this program as super-user.
H/W path Device Class Description
==========================================================
system Computer
/0 bus Motherboard
/0/2 memory 251GiB System memory
/0/3 processor Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
/0/4 processor Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
/0/100 bridge Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DMI2
/0/100/1 bridge Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI Express Root
Or save into html file:
tux@labucs1:~$ sudo lshw -html > lshw.html
1.1 lscpu (display information about the CPU architecture)
DESCRIPTION
lscpu gathers CPU architecture information from sysfs and /proc/cpuinfo. The command output can be optimized for parsing or for easy readability by humans.
Syntax:
lscpu [-a|-b|-c] [-x] [-s directory] [-e[=list]|-p[=list]]
Popular options
lshw -short
lshw -html
lshw -xml
lshw -sanitize
Installation:
Debian/Ubuntu:
sudo apt install util-linux
Redhat/CentOS/Fedora
yum install util-linux
dnf install util-linux
Sample Output:
1.2 lspci (list all PCI devices)
DESCRIPTION
lspci is a utility for displaying information about PCI buses in the system and devices connected to them.
Syntax:
lspci [options]
Popular options
Installation:
Debian/Ubuntu:
sudo apt install pciutils
Redhat/CentOS/Fedora
yum install pciutils
dnf install pciutils
Sample Output:
1.3. Other ls*** are:
lsblk (included when installing util-linux)
lsusb
sudo apt install usbutil
lsscsi
sudo apt install lsscsci
2.dmidecode (DMI table decoder)
dmidecode is a tool for dumping a computer’s DMI (some say SMBIOS) table contents in a human-readable format. This table contains a description of the system’s hardware components, as well as other useful pieces of information such as serial numbers and BIOS revision.
Syntax:
dmidecode [options]
Popular options:
dmidecode -t [options]
e.g.
dmidecode -t system
dmidecode -t memory
dmidecode -t processor
dmidecode -s [options]
Installation:
Debian/Ubuntu:
sudo apt install dmidecode
Redhat/CentOS/Fedora
yum install dmidecode
dnf install dmidecode
Sample Output:
tux@labucs1:~$ sudo dmidecode -t 1
# dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 3.0 present.
Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: Cisco Systems Inc
Product Name: UCSC-C240-M4SX
Version: A0
Serial Number: ABCDEFG
UUID: F78355BB-B3AA-BB4B-CCF5-EE9C7A21935A
Wake-up Type: Power Switch
SKU Number: Not Specified
Family: Not Specified
3.hwinfo (probe for hardware)
DESCRIPTION
hwinfo is used to probe for the hardware present in the system. It can be used to generate a system overview log which can be later used for support.
Syntax:
hwinfo [options]
Popular options:
hwinfo –short
hwinfo –short –cpu
hwinfo –short –netcard
hwinfo –short –storage
Installation:
Debian/Ubuntu:
sudo apt install hwinfo
Fedora
dnf install hwinfo
Sample Output:
tux@labucs1:~$ hwinfo –short –storage
storage:
Intel C610/X99 series chipset 6-Port SATA Controller [AHCI mode]
Cisco VIC FCoE HBA
Cisco VIC FCoE HBA
LSI Logic / Symbios Logic MegaRAID SAS-3 3108 [Invader]
4. inxi (Command line system information script for console and IRC)
DESCRIPTION
inxi is a command line system information script built for for console
and IRC. It is also used for forum technical support, as a debugging
tool, to quickly ascertain user system configuration and hardware.
Syntax:
inxi [-AbCdDfFGhHiIlmMnNopPrRsSuw] [-c NUMBER] [-v NUMBER]
Popular options:
inxi -S –> System
inxi -M –> Machine
inxi -C –> CPU
inxi -G –> Graphics
inxi -N –> Network
inxi -A –> Audio
inxi -D –> Disk
inxi -s –> sensor
inxi -b –> basic info
inxi -F –> full info
Installation:
Debian/Ubuntu:
sudo apt install inxi
Fedora
dnf install inxi
Note: Use this command to to check for programs to operate.
inxi –recommends
Sample Output:
tux@labucs1:~$ inxi –recommends
inxi will now begin checking for the programs it needs to operate. First a check of the main languages and tools
inxi uses. Python is only for debugging data collection.
—————————————————————————
Bash version: 4.3.48(1)-release
Gawk version: 4.1.3,
Sed version:
Sudo version: 1.8.16
Python version: 2.7.12
—————————————————————————
Test One: Required System Directories (Linux Only).
If one of these system directories is missing, inxi cannot operate:
/proc…………………………………………………………….. Present
/sys……………………………………………………………… Present
—————————————————————————
All tests completed
Sample Output:
tux@labucs1:~$ inxi -s
Sensors: System Temperatures: cpu: 37.0C mobo: N/A
Fan Speeds (in rpm): cpu: N/A
tux@labucs1:~$ inxi -b -s
System: Host: labucs1 Kernel: 4.4.0-169-generic x86_64 (64 bit) Console: tty 9 Distro: Ubuntu 16.04 xenial
Machine: System: Cisco Systems product: UCSC-C240-M4SX v: A0
Mobo: Cisco Systems model: UCSC-C240-M4SX v: 74-12420-02
Bios: Cisco Systems v: C240M4.2.0.13d.0.0812161132 date: 08/12/2016
CPU(s): 2 Deca core Intel Xeon E5-2630 v4s (-HT-MCP-SMP-) speed/max: 1199/3100 MHz
Graphics: Card: Matrox Systems MGA G200e [Pilot] ServerEngines (SEP1)
Display Server: X.org 1.18.4 drivers: mga (unloaded: fbdev,vesa)
tty size: 116×42 Advanced Data: N/A out of X
Network: Card-1: Cisco Systems VIC Ethernet NIC driver: enic
Card-2: Cisco Systems VIC Ethernet NIC driver: enic
Card-3: Intel Ethernet Controller X710 for 10GbE SFP+ driver: i40e
5. Displaying info from these folders:
a. /proc/
e.g. cpuinfo,meminfo,
Sample Output:
tux@labucs1:~$ tux@labucs1:~$ head /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
stepping : 1
microcode : 0xb000038
cpu MHz : 1242.140
cache size : 25600 KB
physical id : 0
b. /sys/devices/virtual/dmi/id/
tux@labucs1:~$ ls /sys/devices/virtual/dmi/id/
e.g., chassis_version, board_vendor, chassis_type,product_version
board_asset_tag board_version chassis_vendor product_name subsystem
Sample Output:
tux@labucs1:~$ cat /sys/devices/virtual/dmi/id/product_name
UCSC-C240-M4SX