Getting hardware information about your computer.

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
3,057
Reaction score
2,783
Credits
26,595

Exploring Hardware Information on Linux with lspci, lshw, and inxi​

When managing a Linux system, it's often necessary to gather detailed information about the hardware components. Three powerful tools for this purpose are lspci, lshw, and inxi. Each of these commands provides different levels of detail and focuses on various aspects of the hardware.

Using lspci​

The lspci command lists all PCI devices on your system. This includes information about graphics cards, network adapters, and other peripherals connected via the PCI bus.

Basic Usage:
Code:
 lspci

Common Flags:

  • -v: Provides verbose output with more detailed information.
    Code:
     lspci -v
  • -s [bus:slot.func]: Shows information about a specific device.
    Code:
     lspci -s 00:1f.2
  • -k: Displays the kernel driver handling each device.
    Code:
     lspci -k
Network Interface Example: To list network interfaces, you can filter the output to show only network-related devices.
Code:
 lspci | grep -i net

CPU Example: While lspci is not typically used for CPU information, it can show related devices like the CPU bridge.
Code:
 lspci | grep -i cpu

Using lshw​

The lshw (list hardware) command provides detailed information about all hardware components. It can display information about memory, CPU, disks, and more.

Basic Usage:
Code:
 sudo lshw

Common Flags:

  • -short: Displays a summary of hardware information.
    Code:
     sudo lshw -short
  • -class [class]: Shows information about a specific class of hardware (e.g., memory, CPU).
    Code:
     sudo lshw -class memory
  • -html: Outputs the information in HTML format.
    Code:
     sudo lshw -html > hardware_info.html
Network Interface Example: To get detailed information about network interfaces, use the -class flag with network.
Code:
 sudo lshw -class network

CPU Example: To get detailed information about the CPU, use the -class flag with cpu.
Code:
 sudo lshw -class cpu

Using inxi​

The inxi command is a versatile system information tool that provides a comprehensive overview of your system's hardware and software.

Basic Usage:
Code:
 inxi

Common Flags:

  • -F: Displays full information about the system.
    Code:
     inxi -F
  • -G: Shows detailed information about the graphics.
    Code:
     inxi -G
  • -S: Provides system information including the kernel, uptime, and more.
    Code:
     inxi -S
Network Interface Example: To display detailed information about network interfaces, use the -N flag.
Code:
 inxi -N

CPU Example: To display detailed information about the CPU, use the -C flag.
Code:
 inxi -C

Additional Tips​

  • Combining Commands: You can combine these commands with other tools like grep to filter specific information. For example, to find the memory size:
    Code:
     sudo lshw -class memory | grep size
  • Updating PCI IDs: Ensure your PCI IDs are up-to-date for accurate lspci output:
    Code:
     sudo update-pciids
  • Filtering Output: Use grep to filter the output of these commands for specific details. For example, to find the CPU model:
    Code:
     sudo lshw -class cpu | grep product
  • Combining Commands: Combine commands to get a comprehensive overview. For example, to get both CPU and network information:
    Code:
     inxi -C -N
By using these tools and flags, you can gather detailed and specific information about your Linux system's hardware.
 


For a simpler approach, I like fastfetch.

For more detailed CPU information, I like cpuinfo, sometimes this is called python3-cpuinfo depending on your distro.
 
While I am not an enthusiast of DE-specific graphical tools, I am quite impressed by the KDE's InfoCenter, which I believe is a front-end to many of the above tools. Really convenient for a quick look.

1736219617318.png
 

Staff online

Members online


Top