How to Check Hardware Info with `lshw` on Arch Linux
lshw
on Arch LinuxCategories:
5 minute read
When managing a Linux system, one of the most important tasks is understanding the underlying hardware. Whether you are troubleshooting, upgrading, or simply taking inventory, having access to detailed hardware information is essential. On Arch Linux, the command-line tool lshw
(short for “list hardware”) provides a comprehensive way to display detailed information about your system’s hardware components.
This article will guide you through installing, using, and interpreting the output of lshw
on Arch Linux, along with some best practices and complementary tools.
What is lshw
?
lshw
is a small but powerful command-line utility that provides detailed information on the hardware configuration of a machine. It reports data on a wide range of components, including:
- CPU
- RAM
- Motherboard
- Firmware (BIOS/UEFI)
- Graphics
- Network interfaces
- Storage (disks and controllers)
- USB controllers and peripherals
Unlike some other tools that offer limited or generic info (like lscpu
or lsblk
), lshw
dives deeper by collecting data from multiple system sources such as /proc
, /sys
, and DMI tables.
Installing lshw
on Arch Linux
On Arch Linux, lshw
is not included in the base system and must be installed from the official repositories. To install it, use pacman
:
sudo pacman -S lshw
This will install the lshw
binary and its man page.
Running lshw
– Basic Usage
Once installed, you can run lshw
with the following command:
sudo lshw
Note: Running lshw
without sudo
may result in incomplete information because some data requires root privileges to access.
The output is typically long and may include hundreds of lines. It is structured in a tree-like format, displaying hardware components and their properties.
Here is a sample snippet of what part of the output might look like:
*-cpu
description: CPU
product: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
vendor: Intel Corp.
physical id: 3
bus info: cpu@0
size: 1800MHz
capacity: 4600MHz
width: 64 bits
To make this output easier to work with, you can redirect it to a file:
sudo lshw > hardware_report.txt
Display Formats
By default, lshw
shows output in a human-readable format, but it also supports several other formats that are useful for scripting or integration into monitoring systems.
Short Format
To get a summarized list of detected devices, you can use:
sudo lshw -short
This provides a concise table of hardware devices and their descriptions:
H/W path Device Class Description
=====================================================
/0/0 memory 64KiB BIOS
/0/2 memory 16GiB System Memory
/0/2/0 memory 8GiB SODIMM DDR4
/0/2/1 memory 8GiB SODIMM DDR4
/0/3 processor Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
XML Output
For exporting or parsing with external programs:
sudo lshw -xml > hardware_info.xml
JSON Output
For modern automation scripts or integration with APIs:
sudo lshw -json > hardware_info.json
Filtering Output by Class
You can limit lshw
’s output to specific hardware types using the -class
option. For example:
Show only CPU information
sudo lshw -class processor
Show memory information
sudo lshw -class memory
Show storage devices
sudo lshw -class disk
Other available classes include: display
, network
, storage
, multimedia
, communication
, and more.
To see all possible classes, you can explore the full output once and then narrow it down in future queries.
Understanding the Output
Here’s a quick breakdown of key fields in lshw
output:
- description – A short text describing the component.
- product – The model or product name.
- vendor – The manufacturer of the component.
- physical id – Physical location or ID used by the kernel.
- bus info – The device’s address on the system bus.
- version – Firmware or hardware revision.
- serial – Serial number (if available).
- size/capacity – Memory size or device capacity.
- width – Bit-width of the data bus (e.g., 32-bit or 64-bit).
This information is particularly useful for:
- Verifying the installed RAM and its speed.
- Identifying storage interfaces (SATA vs NVMe).
- Checking GPU vendor/model before installing drivers.
- Confirming CPU model and virtualization support.
Real-World Examples
1. Verify CPU Model and Cores
sudo lshw -class processor
Look for entries like:
*-cpu
product: AMD Ryzen 7 5800X
size: 3800MHz
capacity: 4700MHz
cores: 8
2. Check RAM Configuration
sudo lshw -class memory
This will show you the number of memory slots used, total capacity, and each module’s size/speed.
3. Identify Network Interfaces
sudo lshw -class network
Useful for determining if you’re using Intel, Realtek, or Broadcom interfaces and checking driver compatibility.
4. Examine Disk Controllers and Drives
sudo lshw -class disk -class storage
See details such as disk type, interface (NVMe/SATA), and vendor info.
When and Why to Use lshw
There are several use cases where lshw
proves to be an indispensable tool:
- Troubleshooting hardware issues – Confirming component specifications and presence.
- Pre-installation checks – Ensuring compatibility before installing specialized drivers or software.
- Remote inventory auditing – Automating data collection across multiple systems.
- Upgrades and planning – Checking open RAM slots, current disk interface, or GPU model.
Complementary Tools
While lshw
is powerful, it works even better alongside a few other utilities:
Tool | Purpose |
---|---|
lscpu | Quick overview of CPU specs |
lsblk | Lists block devices (partitions, disks) |
inxi | User-friendly hardware summary |
dmidecode | Dumps low-level BIOS/firmware info |
hwinfo | Similar to lshw , more verbose |
neofetch | Visual overview with system branding |
For example, inxi -Fxz
provides a clean overview and can supplement lshw
in reports.
Tips and Best Practices
- Always run
lshw
withsudo
to ensure full hardware visibility. - Use
-short
for quick overviews or tables. - Redirect output to files (
> output.txt
) for documentation or offline analysis. - For scripts or system integration, prefer JSON or XML output.
- Consider using
watch
or cron jobs withlshw
to periodically log hardware changes.
Conclusion
Understanding the hardware makeup of your system is essential for both system administrators and power users. On Arch Linux, lshw
is a highly capable utility that fills this need with comprehensive and reliable hardware data.
Whether you’re diagnosing a hardware issue, preparing for an upgrade, or auditing a fleet of systems, lshw
gives you the insight you need to make informed decisions. When combined with other tools like lscpu
, inxi
, or lsblk
, it becomes part of a robust toolbox for system analysis and maintenance.
So the next time you need to know what’s under the hood of your Arch system, don’t guess—use lshw
.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.