BASH Hardware Discovery

From Indie IT Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

HOWTO:

List Hardware

Full Listing:

sudo lshw

Short Listing:

sudo lshw -short

Save To File:

sudo lshw -html > /path/to/file/lshw.html

CPU Information

sudo lscpu

Block Devices

Such as hard drives, flash drives etc.

sudo lsblk

sudo lsblk -a # Expanded details

USB Information

sudo lsusb

sudo lsusb -v # Expanded details

PCI Information

sudo lspci

sudo lspci -t # Information in tree format

sudo lspci -v # Expanded details

SCSI Information

Also covers SATA devices.

sudo lsscsi

sudo lsscsi -s # Lists capacities where applicable

SATA Devices Information

sudo hdparm /dev/sdX # Where X is the label of the drive on your system

sudo hdparm -h # Lists all switch options

CMR vs SMR Drives

SMR (Shingled Magnetic Recording) disks are much slower than standard CMR (Conventional Magnetic Recording) disks.

To test if you have a good or bad drive, follow these commands...

sudo hdparm -I /dev/sda | grep -i TRIM

...if the drive supports TRIM then it's SMR.

SMR Disks

File System Information

sudo fdisk -l

Memory Details

sudo dmidecode -t memory

BIOS Information

sudo dmidecode -s bios-version
sudo dmidecode -s bios-release-date
sudo apt-get install libsmbios-bin
sudo getSystemId

Libsmbios version:      2.4.1
Product Name:           XPS 13 9350
Vendor:                 Dell Inc.
BIOS Version:           1.7.0
System ID:              0x0704
Service Tag:            878KJC2
Express Service Code:   17851917026

Maximum Amount Of RAM Supported By The Motherboard

sudo dmidecode -t 16

or

sudo perl memconf

Thanks to 4Smidts.

Motherboard Details

sudo dmidecode | grep -A4 'Base Board'

The above should return something similar too:

Base Board Information
	Manufacturer: ASUSTeK Computer INC.
	Product Name: M5A78L-M/USB3
	Version: Rev X.0x
	Serial Number: 130208251600119

Other options include:

bios-vendor 
bios-version
bios-release-date
system-manufacturer
system-product-name
system-version
system-serial-number
system-uuid
baseboard-manufacturer
baseboard-product-name
baseboard-version
baseboard-serial-number
baseboard-asset-tag
chassis-manufacturer
chassis-type
chassis-version
chassis-serial-number
chassis-asset-tag
processor-family
processor-manufacturer
processor-version processor-frequency