Post

Commands to get hardware infomation | LinuxGist

This article will provide details on how various commands can be used to get hardware information in a Linux system.

Here’s a categorized list of Linux commands to retrieve hardware information:


1. CPU Information

  • lscpu: Displays CPU architecture details.
    1
    
    lscpu
    
  • cat /proc/cpuinfo: Detailed CPU information.
    1
    
    cat /proc/cpuinfo
    
  • dmidecode -t processor: Detailed processor information.
    1
    
    sudo dmidecode -t processor
    

2. Memory Information

  • free -h: Memory usage in a human-readable format.
    1
    
    free -h
    
  • cat /proc/meminfo: Detailed memory statistics.
    1
    
    cat /proc/meminfo
    
  • dmidecode -t memory: Information about RAM modules.
    1
    
    sudo dmidecode -t memory
    

    This command can be used to find the installed RAM modules and any free slots where more RAM can be added.

    1
    
    sudo dmidecode -t memory|grep Size
    

    We can see 2 more RAM cards can be added on this example system:

    1
    2
    3
    4
    
      Size: 16 GB
      Size: 16 GB
      Size: No Module Installed
      Size: No Module Installed
    

3. Disk and Storage Information

  • lsblk: Lists block devices in a tree format.
    1
    
    lsblk
    
  • df -h: Shows disk usage for mounted filesystems.
    1
    
    df -h
    
  • fdisk -l: Lists disk partitions and sizes.
    1
    
    sudo fdisk -l
    
  • blkid: Displays UUID and filesystem types of block devices.
    1
    
    sudo blkid
    

4. PCI Devices

  • lspci: Lists all PCI devices.
    1
    
    lspci
    
  • lspci -vv: Provides detailed PCI device information.
    1
    
    lspci -vv
    

5. USB Devices

  • lsusb: Lists all connected USB devices.
    1
    
    lsusb
    
  • lsusb -v: Provides verbose USB device details.
    1
    
    sudo lsusb -v
    

6. Network Interfaces

  • ip a: Displays network interface details.
    1
    
    ip a
    
  • ethtool <interface>: Provides details about a specific network interface.
    1
    
    sudo ethtool eth0
    
  • nmcli dev status: Shows the status of network devices.
    1
    
    nmcli dev status
    

7. Graphics Card

  • lspci | grep -i vga: Shows graphics card information.
    1
    
    lspci | grep -i vga
    
  • glxinfo | grep -i opengl: Displays GPU rendering and OpenGL details.
    1
    
    glxinfo | grep -i opengl
    

8. BIOS/UEFI Information

  • dmidecode -t bios: Displays BIOS/UEFI details.
    1
    
    sudo dmidecode -t bios
    

9. Motherboard Information

  • dmidecode -t baseboard: Details about the motherboard.
    1
    
    sudo dmidecode -t baseboard
    
  • dmidecode -t chassis: Information about the system chassis.
    1
    
    sudo dmidecode -t chassis
    

10. Audio Devices

  • aplay -l: Lists sound cards for ALSA.
    1
    
    aplay -l
    
  • lspci | grep -i audio: Finds audio-related PCI devices.
    1
    
    lspci | grep -i audio
    

11. Hardware Overview (All Categories)

  • inxi -F: Comprehensive system information.
    1
    
    inxi -F
    
  • hwinfo: Detailed hardware information (requires installation).
    1
    
    sudo hwinfo
    

12. Battery Information (For Laptops)

  • upower -i /org/freedesktop/UPower/devices/battery_BAT0: Battery details.
    1
    
    upower -i /org/freedesktop/UPower/devices/battery_BAT0
    
  • acpi -i: Battery charge and status (requires installation).
    1
    
    acpi -i
    

13. Kernel and System Information

  • uname -a: Displays kernel version and architecture.
    1
    
    uname -a
    
  • hostnamectl: Shows hostname and system information.
    1
    
    hostnamectl
    

    Output

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
     Static hostname: precision
         Icon name: computer-desktop
           Chassis: desktop 🖥️
        Machine ID: dcfxxxxx10824959834645dxxxxxx
           Boot ID: 45a2d4c3xxxxxxx385ef5dfxxxxxx
    Operating System: Ubuntu 24.04.1 LTS              
            Kernel: Linux 6.8.0-51-generic
      Architecture: x86-64
     Hardware Vendor: Dell Inc.
    Hardware Model: Precision 3630 Tower
    Firmware Version: 2.26.0
     Firmware Date: Fri 2023-12-08
      Firmware Age: 1y 1month 3d
    

Installation Notes for Tools

Some commands may require additional tools to be installed:

  • Install with apt, yum, or dnf depending on your distribution:
    1
    2
    3
    
    sudo apt install dmidecode inxi hwinfo mesa-utils acpi  # Debian/Ubuntu
    sudo yum install dmidecode inxi hwinfo glxinfo acpi  # RHEL/CentOS
    sudo dnf install dmidecode inxi hwinfo glxinfo acpi  # Fedora
    

Summary

These commands provide a range of information about the hardware components on your Linux system. While some of these tools may require root privileges, they offer comprehensive details that can help in diagnosing hardware issues or understanding the configuration of your system.

This post is licensed under CC BY 4.0 by the author.