How to Get Hardware Details from Command Line on Ubuntu

This post describes hot to get details on CPU, disk, display, and memory from the command line on Ubuntu.

CPU

cat /proc/cpuinfo | grep 'model name\|cpu family\|processor\|cache size' | sort -u

Here's an example of the output:

cache size	: 12288 KB
cpu cores	: 6
cpu family	: 6
model name	: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
processor	: 0
processor	: 1
processor	: 10
processor	: 11
processor	: 2
processor	: 3
processor	: 4
processor	: 5
processor	: 6
processor	: 7
processor	: 8
processor	: 9
  • The cache size indicates the L2 memory cache available to the processor.
  • The cpu cores represents the number of cores
  • cpu family tells you the type of processor you have. In this case, it's an Intel and placing the value in front of "86" tells us it's "686" and since it's a 64-bit chip, you'll commonly see it represented as "x86-64."
  • model name is self-explanatory
  • The number of processor lines indicates the number of threads. In this case, 12.

Disk

hwinfo --disk | grep 'Device Files'

Note: You may have to install hwinfo

Here's an example of the output (in this case I have two disks):

  Device Files: /dev/nvme0n1, /dev/disk/by-id/nvme-Samsung_SSD_970_PRO_1TB_S462NF0M621968K, /dev/disk/by-path/pci-0000:04:00.0-nvme-1, /dev/disk/by-id/nvme-eui.0025385691b57092
  Device Files: /dev/sda, /dev/disk/by-label/disk1, /dev/disk/by-id/wwn-0x5002538e40529604, /dev/disk/by-id/ata-Samsung_SSD_860_EVO_1TB_S3Z8NB0K702696L, /dev/disk/by-uuid/67864506-3ff3-4bc0-bd88-3cdacee5ca46, /dev/disk/by-path/pci-0000:00:17.0-ata-1

Video Card

sudo lshw -c display | grep 'product\|vendor'

Example output:

  product: GP106 [GeForce GTX 1060 6GB]
   vendor: NVIDIA Corporation

Memory

sudo dmidecode --type 17 | grep -e 'Speed\|Type:\|Size' | sort -u

Example output:

Configured Memory Speed: 2133 MT/s
                   Size: 16384 MB
                  Speed: 2133 MT/s
                   Type: DDR4

Motherboard

sudo dmidecode -t 2

Example output:

# dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 3.4.0 present.

Handle 0x0002, DMI type 2, 15 bytes
Base Board Information
	Manufacturer: ASUSTeK COMPUTER INC.
	Product Name: PRIME Z690-A
	Version: Rev 1.xx
	Serial Number: 211093348801331
	Asset Tag: Default string
	Features:
		Board is a hosting board
		Board is replaceable
	Location In Chassis: Default string
	Chassis Handle: 0x0003
	Type: Motherboard
	Contained Object Handles: 0