We have lot of commands in linux but some give more details what we expect, here are the few which gives too depth detail about hardware information on linux. Each command we can use different scenario. This all contains details about hardware components like CPU, memory and more.
- lscpu
lscpu gathers CPU architecture information from sizes and /proc/cpuinfo. The command output can be optimized for parsing or for easy readability by humans. The information
includes, for example, the number of CPUs, threads, cores, sockets, and Non-Uniform Memory Access (NUMA) nodes. There is also information about the CPU caches and cache sharing, family, model, bogoMIPS, byte order, and stepping.
# lscpu
- lshw – List Hardware
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).
It currently supports DMI (x86 and IA-64 only), Open Firmware device tree (PowerPC only), PCI/AGP, CPUID (x86), IDE/ATA/ATAPI, PCMCIA (only tested on x86), SCSI and USB.
# lshw -short
- hwinfo – Hardware Information
Hwinfo is another general purpose hardware probing utility that can report detailed and brief information about multiple different hardware components, and more than what lshw can report.
# hwinfo –short
- lspci – List PCI
The lspci command lists out all the pci buses and details about the devices connected to them.
The vga adapter, graphics card, network adapter, usb ports, sata controllers, etc all fall under this category.
# lspci
Filter out specific device information with grep.
# lspci -v | grep “VGA” -A 12
- lsscsi – List scsi devices
Lists out the scsi/sata devices like hard drives and optical drives.
# lsscsi
[3:0:0:0]   disk   ATA     ST3500418AS     CC38 /dev/sda
[4:0:0:0]   cd/dvd SONY    DVD RW DRU-190A 1.63 /dev/sr0
- lsusb – List usb buses and device details
This command shows the USB controllers and details about devices connected to them. By default brief information is printed. Use the verbose option “-v” to print detailed information about each usb port
# lsusb
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 002: ID 045e:00cb Microsoft Corp. Basic Optical Mouse v2.0
On the above system, 1 usb port is being used by the mouse.
- lsblk – List block devices
List out information all block devices, which are the hard drive partitions and other storage devices like optical drives and flash drives
# lsblk
- df – disk space of file systems
Reports various partitions, their mount points and the used and available space on each.
# df -H
- Pydf – Python df
An improved df version written in python, that displays colored output that looks better than df
# pydf
- fdisk
Fdisk is a utility to modify partitions on hard drives, and can be used to list out the partition information as well.
# fdisk -l
- mount
The mount is used to mount/unmount and view mounted file systems.
# mount | column –t
Again, use grep to filter out only those file systems that you want to see
# mount | column -t | grep ext
- free – Check RAM
Check the amount of used, free and total amount of RAM on system with the free command.
# free -m
total      used      free    shared   buffers    cached
Mem:Â Â Â Â Â Â Â Â Â 1861Â Â Â Â Â Â Â 850Â Â Â Â Â Â 1010Â Â Â Â Â Â Â Â Â 0Â Â Â Â Â Â Â 136Â Â Â Â Â Â Â 476
-/+ buffers/cache:Â Â Â Â Â Â Â 237Â Â Â Â Â Â 1623
Swap:Â Â Â Â Â Â Â Â 2047Â Â Â Â Â Â Â Â Â 1Â Â Â Â Â Â 2046
- dmidecode
The dmidecode command is different from all other commands. It extracts hardware information by reading data from the SMBOIS data structures (also called DMI tables).
# display information about the processor/cpu
# dmidecode -t processor
# memory/ram information
# dmidecode -t memory
# bios details
# dmidecode -t bios
Check out the man page for more details.
- /proc files
Many of the virtual files in the /proc directory contain information about hardware and configurations. Here are some of them
CPU/Memory information
# cpu information
# cat /proc/cpuinfo
# memory information
# cat /proc/meminfo
Linux/kernel information
# cat /proc/version
Linux version 2.6.32-642.3.1.el6.x86_64 (mockbuild@worker1.bsys.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) ) #1 SMP Tue Jul 12 18:30:56 UTC 2016
SCSI/Sata devices
# cat /proc/scsi/scsi
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
Type:Â Â CD-ROMÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ANSIÂ SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: VMware  Model: Virtual disk    Rev: 1.0
Type:  Direct-Access                   ANSI SCSI revision: 02
Partitions
# cat /proc/partitions
major minor #blocks name
8Â Â Â Â Â Â Â 0Â Â 52428800 sda
8Â Â Â Â Â Â Â 1Â Â Â Â Â Â 1024 sda1
8Â Â Â Â Â Â Â 2Â Â Â 1048576 sda2
8Â Â Â Â Â Â Â 3Â Â Â 9434112 sda3
8Â Â Â Â Â Â Â 4Â Â 41943040 sda4
253Â Â Â Â Â Â Â 0Â Â 49274880 dm-0
253Â Â Â Â Â Â Â 1Â Â Â 2097152 dm-1
- hdparm
hdparm provides a command line interface to various kernel interfaces supported by the Linux SATA/PATA/SAS “libata” subsystem and the older IDE driver subsystem. Many newer (2008 and later) USB drive enclosures now also support “SAT” (SCSI-ATA Command Translation) and therefore may also work with hdparm. Some options may work correctly only with the latest kernels.
 # hdparm -i /dev/sda
/dev/sda:
Model=ST3500418AS, FwRev=CC38, SerialNo=9VMJXV1N
Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
BuffType=unknown, BuffSize=16384kB, MaxMultSect=16, MultSect=16
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=976773168
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes:Â pio0 pio1 pio2 pio3 pio4
DMA modes:Â mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
AdvancedPM=no WriteCache=enabled
Drive conforms to: unknown:Â ATA/ATAPI-4,5,6,7
* signifies the current active mode