:bulb: This post collects commands for inspecting the hardware installed on a server: CPU, memory, disks, network interface cards, GPU, and so on.

:book: Based on Ubuntu 24.04 Server

[01] Related Commands

Command Description
dmidecode Print hardware info from the system DMI (SMBIOS) tables
free Show available and used memory
lshw Extract hardware config such as memory settings, firmware version, CPU speed, and bus speed
lsblk List block device info, derived from the sysfs filesystem
lscpu Print CPU info: architecture, cores/threads, sockets, etc.

[02] CPU Information

1
2
3
4
5
6
lscpu

# Extract only the relevant fields
# Architecture, number of processors, threads per core, cores per socket, sockets, model name, NUMA info
# Processors = Cores * threads-per-core * sockets
lscpu |grep -E 'Archi|On-line|Thread|socket|Socket|Model |NUMA'

2022-10-27 13 40 43

[03] Memory Information

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Show the size of installed memory (including empty slots)
dmidecode -t memory |grep -i size

# Show only the slots that actually have memory installed
dmidecode -t memory |grep -i size | egrep -Ev No

# Count the number of populated memory slots
dmidecode -t memory |grep -i size | egrep -Ev No | wc -l

# Show total memory capacity
free -mh

# When `dmidecode -t memory` output includes lines like "Volatile Size"
# Count total slots = (slots with GB value) + (No Module Installed) - (Volatile Size lines)
dmidecode -t memory | egrep "Size: ([0-9]+ GB|No Module Installed)" |grep -v "Volatile Size:" | wc -l

# List installed memory modules and count them
dmidecode -t memory | egrep "Size: [0-9]+ GB" | grep -v "Volatile Size:"
dmidecode -t memory | egrep "Size: [0-9]+ GB" | grep -v "Volatile Size:"| wc -l

# List empty slots and count them
dmidecode -t memory | egrep "Size: No Module Installed"
dmidecode -t memory | egrep "Size: No Module Installed" | wc -l

# Check the DDRx generation of the installed memory
lshw -short -C memory

2022-10-27 13 15 45

Image

[04] Disk Information

1
2
3
4
5
# Show disk devices
lsblk

# Show disk devices with bus info
lshw -c disk -businfo

[05] Network Information

1
2
# Show network devices with bus info
lshw -c network -businfo

2022-10-27 13 44 10

[06] GPU Information

1
2
3
4
5
# Show display/GPU devices
lshw -C display

# When using an NVIDIA GPU with the driver installed
nvidia-smi