Learning about your system’s hardware setup within the Ubuntu terminal
In this post, I gathered the commands that are needed to know about the system’s CPU, GPU, system memory, disk, and how CPUs and GPUs are connected.
CPU
The primary processor’s information can be revealed with the following command.
lscpu
In the output, you will see the info as follows.
or we can use the dmidecode command that needs admin privileges.
sudo dmidecode --type processor
The valid values of types are:
To read about every Linux command use the “man” command like the following example:
man lscpu # the manual of "lscpu" command
System memory
For knowing the size in KBs.
grep MemTotal /proc/meminfoStorage
For seeing the modules with more information about them, which needs admin privileges.
sudo dmidecode --type memory # processor, bios, system, baseboard, chassis, processor, memory, cache, connector, slot
DMI stands for Desktop Management Interface. To read more about it and dmidecode command, check the following link:
https://linux.die.net/man/8/dmidecode
Also, we can use the “top” command and we can observe how much system memory we have in total.
Storage
For checking storage disks, the following commands will give you the info you need.
lsblk
The output will be as follows, the type of the disk can be detected by its name.
For example, the machine above has two NVMe disks: one with 7T and another with ~900GB capacity.
GPU
nvidia-smi
The output will be like:
CPU-GPU connection
nvidia-smi topo -m
The output will be like:
PCIe Connections
sudo dmidecode - type 9 # 9 or slot
The output will be as follows showing PCI slots with their version available on the system.
Some useful links for reading more about PCI