Innovate | Connect | Transform
ContactService statusUSD $

GICT knowledge base

How to Check Hardware Information from the Terminal

Published

LinuxSystem Administration

Understanding your system’s hardware is essential for troubleshooting, performance tuning, upgrades, and system monitoring. On Linux and other Unix-like systems, you can gather comprehensive hardware details directly from the terminal-no graphical tools required. Whether you need information on the CPU, memory, storage, network interfaces, or peripherals, the command line gives you powerful options for querying, monitoring, and exporting hardware data.

This article provides a thorough, step-by-step guide to checking hardware information from the terminal. You will learn about built-in and third-party tools, command examples, interpretation of outputs, and best practices for hardware auditing and reporting.

Prerequisites

  • Access to a Linux system with terminal privileges
  • Basic familiarity with the command line
  • (Optional) Sudo or root privileges for some commands
  • Updated package management tools to install additional utilities as needed

Why Check Hardware Information from the Terminal?

  • Troubleshooting: Identify faulty components or verify system specifications.
  • Performance Tuning: Match hardware capabilities with software configurations.
  • Capacity Planning: Determine upgrade requirements based on current hardware.
  • Inventory and Auditing: Maintain records of hardware for compliance or asset management.
  • Remote Management: Collect hardware information on headless or remote systems via SSH.

Fundamental Built-in Commands

Most Linux distributions come with basic commands that display hardware information without additional installation.

1. Checking CPU Information

The CPU (Central Processing Unit) is the brain of your computer. To retrieve CPU details:

$ cat /proc/cpuinfo

This command outputs detailed information for each processor core, including:

  • Model name and vendor
  • Clock speed (MHz)
  • Number of cores/logical CPUs
  • Cache size
  • Supported CPU flags/features

Sample output:

model name  : Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
cpu cores   : 4
siblings    : 8
cache size  : 6144 KB
flags       : fpu vme de pse tsc msr pae ...

To see a summary:

$ lscpu

lscpu provides a human-readable overview, including architecture (x86_64, ARM), threads per core, cores per socket, sockets, and virtualization support.

2. Checking Memory (RAM) Information

To display memory usage and installed RAM:

$ free -h

This shows total, used, free, shared, buffer/cache, and available memory in a human-readable format.

For more detailed information:

$ cat /proc/meminfo

or

$ vmstat -s

To list all detected memory modules and their specifications:

$ sudo dmidecode --type memory

This shows details like module size, speed, manufacturer, serial number, and slot location.

3. Checking Storage Devices and Partitions

To display block devices (disks, partitions, LVM):

$ lsblk

or for more detail,

$ lsblk -f

Lists device names, mount points, filesystem types, sizes, and labels.

To view disk usage for all mounted filesystems:

$ df -h

To list partition tables:

$ sudo fdisk -l

For information about a particular drive (e.g., /dev/sda):

$ sudo hdparm -I /dev/sda

4. Checking PCI Devices

To list all PCI devices (graphics cards, network cards, etc.):

$ lspci

Add -v for verbose output, -nn to show device IDs, or -k to display drivers in use:

$ lspci -vnnk

Common uses:

  • Identify GPU model and PCI address
  • Check which driver is attached to a network or storage controller

5. Checking USB Devices

To display all connected USB devices:

$ lsusb

For detailed output:

$ lsusb -v

This reveals device manufacturer, product IDs, and interface details.

6. Checking Network Interfaces

To list all network interfaces and their status:

$ ip link show

or the older:

$ ifconfig -a

To display network hardware addresses (MAC), driver, and speed:

$ ethtool eth0

Replace eth0 with your interface name (use ip link to list names).

7. Checking DMI/SMBIOS (System Information)

dmidecode provides in-depth information from your system’s DMI/SMBIOS tables:

$ sudo dmidecode

You can filter for specific information types:

  • System:
    sudo dmidecode --type system
  • BIOS:
    sudo dmidecode --type bios
  • Processor:
    sudo dmidecode --type processor
  • Memory:
    sudo dmidecode --type memory
  • Baseboard:
    sudo dmidecode --type baseboard

Details include manufacturer, model, serial number, BIOS version, asset tags, and more.

8. Checking Sensors (Temperature, Voltage, Fan Speed)

To monitor hardware sensors (CPU temperature, fan speeds, voltages):

Install lm-sensors:

$ sudo apt install lm-sensors

Detect sensors:

$ sudo sensors-detect

Display sensor readings:

$ sensors

9. Checking Graphics Card Information

To display GPU details:

For integrated and discrete GPUs via PCI:

$ lspci | grep -i vga
$lspci | grep -i 3d

For NVIDIA GPUs (requires proprietary driver):

$ nvidia-smi

For AMD GPUs (requires mesa-utils):

$ glxinfo -B

10. Checking Audio Devices

List available audio devices:

$ aplay -l      # List playback devices
$ arecord -l     # List recording devices

For detailed PulseAudio information:

$ pactl list cards

Using Third-Party and Advanced Tools

Many Linux distributions include or provide extra utilities for more detailed or specialized hardware information.

1. inxi

inxi is a versatile system information script with extensive output.

Install inxi:

$ sudo apt install inxi

Display a full hardware summary:

$ inxi -Fxz

You can control the amount and type of detail with options (-C for CPU, -M for motherboard, etc.).

2. hwinfo

hwinfo provides very detailed hardware reports.

Install hwinfo:

$ sudo apt install hwinfo

Get a hardware summary:

$ sudo hwinfo --short

To get detailed info on a specific hardware class:

$ sudo hwinfo --cpu
$ sudo hwinfo --disk
$ sudo hwinfo --network

3. lshw

lshw lists detailed information about all system hardware.

Install lshw:

$ sudo apt install lshw

Display a summary:

$ sudo lshw -short

Export a detailed hardware report:

$ sudo lshw > hardware_report.txt

For specific hardware:

$ sudo lshw -class cpu
$ sudo lshw -class memory

Specialized Queries and Hardware Monitoring

1. Monitoring Real-Time Performance

Use top, htop, or glances for real-time CPU, memory, and process monitoring.

htop provides a user-friendly, color-coded interface.

Install htop:

$ sudo apt install htop

Run:

$ htop

glances offers an overview of all major hardware statistics.

Install and run glances:

$ sudo apt install glances
$ glances

2. Disk Health and SMART Status

Check disk health with SMART tools:

Install smartmontools:

$ sudo apt install smartmontools

Check the health of a drive:

$ sudo smartctl -a /dev/sda

Run a short self-test:

$ sudo smartctl -t short /dev/sda

3. System Boot and Hardware Logs

Boot logs often contain hardware detection and error messages.

View the kernel ring buffer:

$ dmesg | less

Filter for hardware-related keywords, such as error, fail, or usb:

$ dmesg | grep -i usb

Interpreting and Using Hardware Information

1. Hardware Inventory and Documentation

Create a detailed inventory by saving the output of the above commands to text files. Useful for audits, troubleshooting, and warranty purposes.

Example:

$ lscpu > cpu_info.txt
$ sudo lshw > full_hardware.txt
$ lsblk > disk_layout.txt

2. Compatibility and Upgrade Decisions

Check slots, RAM type, maximum capacity, disk interface, and PCIe versions before purchasing upgrades.

3. Troubleshooting

  • Compare dmesg or journalctl logs before and after hardware changes.
  • Use serial numbers and model information for warranty and support requests.
  • Use temperature and SMART data to preemptively replace failing components.

Best Practices for Hardware Checks

  • Run commands with sudo if you get permission errors.
  • Use up-to-date utilities for accurate results.
  • Document your hardware configuration regularly, especially before and after changes.
  • Monitor temperature and disk health periodically.
  • Automate inventory collection with scripts or tools like Ansible for large environments.
  • Back up important configuration and log files before making hardware changes.

Security Considerations

Some hardware information can be sensitive (e.g., serial numbers, MAC addresses). Avoid sharing logs publicly unless sanitized. Use access controls to keep audit data secure.

Common Pitfalls and Troubleshooting

  • Missing Commands: Not all utilities are pre-installed; install as needed with your package manager.
  • Permission Issues: Use sudo for hardware-level queries (e.g., dmidecode, lshw, hwinfo).
  • Virtualized Hardware: Results on virtual machines may show virtual hardware, not the underlying physical components.
  • Non-Standard Hardware: Some laptops, servers, or embedded systems may not fully report hardware details.

Conclusion

The Linux terminal provides powerful tools to view, document, and monitor hardware information across desktops, servers, and virtual environments. By mastering built-in commands like lscpu, lsblk, cat /proc/cpuinfo, and advanced utilities like lshw, hwinfo, and inxi, you gain granular visibility into every aspect of your machine-CPU, memory, storage, peripherals, network interfaces, sensors, and more.

Regularly checking hardware information supports better troubleshooting, performance optimization, capacity planning, and system auditing. Whether you are a system administrator, developer, or enthusiast, these skills help you diagnose problems, plan upgrades, and keep systems running smoothly.

[!NOTE] For the most accurate and complete hardware reports, run hardware checks locally (not through remote terminals), with administrative privileges, and after installing all necessary drivers and firmware.

Related guides

Account services are unavailable until the production backend is configured.