LinuxCommandLibrary

hwinfo

Get detailed hardware information

TLDR

Display all available hardware information

$ hwinfo
copy

Display information about a specific hardware component
$ hwinfo --[cpu|memory|disk|gfxcard|network|usb|pci|keyboard|mouse|monitor|sound|fingerprint|...]
copy

Display information about a specific hardware component succinctly
$ hwinfo [--component] --short
copy

Write all hardware information to a file
$ hwinfo --all --log [path/to/file]
copy

Display help
$ hwinfo --help
copy

SYNOPSIS

hwinfo [options]

PARAMETERS

--all
    Show all hardware information. This is the default behavior if no specific device type is requested.

--cpu
    Show information about the CPU(s).

--memory
    Show information about the RAM modules.

--disk
    Show information about hard disks and other storage devices.

--netcard
    Show information about network interface cards.

--gfxcard
    Show information about graphics cards.

--sound
    Show information about sound cards.

--pci
    Show all PCI devices detected.

--usb
    Show all USB devices detected.

--bios
    Show BIOS and DMI/SMBIOS information.

--monitor
    Show information about connected monitors.

--short
    Display a summarized version of the output, showing less detail.

--bus <type>
    Scan only a specific bus type (e.g., pci, usb).

--log <filename>
    Write the output to the specified file instead of standard output.

--hwid <id>
    Show information for a specific hardware ID.

--only <id>
    Show information only for the given hardware ID.

--recursive
    Scan recursively for all devices.

--debug <level>
    Enable debug output for diagnostics (level is an integer).

--version
    Display the version of hwinfo.

--help
    Display a help message and exit.

DESCRIPTION

The hwinfo command is a powerful utility designed to probe for and display detailed information about the hardware components detected on a Linux system. It gathers data from various sources, including the BIOS (via DMI/SMBIOS), PCI bus, USB bus, CPUID instructions, and kernel modules. This comprehensive tool can identify a wide range of hardware, such as CPUs, memory, storage devices, network cards, graphics cards, sound cards, monitors, and more.

hwinfo is invaluable for system administrators, developers, and users alike. It aids in troubleshooting hardware issues, compiling hardware inventories, verifying driver compatibility, and understanding system configurations. Unlike some lower-level tools that focus on a single type of bus or component, hwinfo strives to provide a consolidated and often human-readable overview of the entire system's hardware landscape.

CAVEATS

For hwinfo to provide complete and accurate information, especially concerning low-level details or devices requiring direct hardware access, it often needs to be run with root privileges (e.g., using sudo). Without root access, some information might be missing or appear incomplete, as it cannot access certain kernel interfaces or files like /dev/mem.

The output can be very verbose, especially when requesting all hardware information, which might require piping the output to a pager like less or redirecting it to a file. While generally reliable, the accuracy of the reported information depends on the underlying kernel's ability to expose hardware details and the correctness of DMI/SMBIOS data provided by the system's firmware.

OUTPUT STRUCTURE

The output of hwinfo is typically structured in sections for each detected hardware component. Each component is identified by a unique ID and its type, followed by a detailed list of attributes such as model, vendor, driver, bus information, capabilities, and configuration parameters. The output often includes both human-readable descriptions and technical identifiers.

DEPENDENCIES AND DATA SOURCES

hwinfo relies on various kernel interfaces and system files to gather its data. Key sources include the /sys filesystem (sysfs), /proc filesystem, DMI/SMBIOS tables accessible via kernel interfaces (often requiring root), and direct probing of PCI and USB buses. It also uses internal databases and rules to interpret raw hardware IDs into understandable device names and properties.

HISTORY

hwinfo originated as part of the SUSE Linux distribution's effort to provide a robust and centralized hardware detection mechanism. Over time, its usefulness led to its adoption in other Linux distributions. It was developed to create a single, consistent source for hardware information, abstracting away the need for users to manually parse outputs from multiple low-level tools like lspci, lsusb, and dmidecode. Its design focuses on presenting information in a structured and easily digestible format, significantly simplifying hardware inventory and diagnostics on Linux systems.

SEE ALSO

lshw(1), lspci(8), lsusb(8), dmidecode(8), lscpu(1), free(1), uname(1)

Copied to clipboard