Last mod: 2024.11.15

Checking hardware configuration in bash

In many scenarios, especially on servers or minimal installations, the graphical interface may not be available, leaving the command line as the only reliable tool for system management. Fortunately, the command line provides powerful utilities to access detailed hardware information, making it invaluable for diagnosing issues, monitoring performance, and understanding system capabilities. Whether you're exploring CPU details, memory usage, or disk information, the terminal ensures you have everything you need, even in the most resource-limited environments. This article highlights key command-line tools to gather and interpret hardware information efficiently.

CPU

cat /proc/cpuinfo

cat /proc/cpuinfo

RAM

cat /proc/meminfo

cat /proc/meminfo

PCI

List PCI devices:

lspci

List PCI devices

If you need more detail then you can use the parameters:

lspci -v  # verbose output
lspci -vv # very verbose output

For example if you need info about GPU then you can use grep:

lspci -v | grep -i vga

PCI VGA

USB

Similarly, we can display USB devices:

lsusb

List USB devices

And show more details:

lspci -v  # verbose output
lspci -vv # very verbose output

Disks (block devices)

To list the connected drives, we can use the command lsblk (List Block Devices). To list information only about physical hardware we will modify the command:

lsblk -o NAME,SIZE,TYPE,MOUNTPOINT -e 7

lsblk

Hardware list

Provides a comprehensive overview of the entire hardware configuration. Includes information about all hardware components, such as:

  • CPU
  • RAM
  • Storage devices
  • Network interfaces
  • USB devices
  • Motherboard details
sudo lshw -short

sudo lshw -short