LinuxAlternative

Linux · System Tools

lshw

lshw is a command‑line tool that lists detailed hardware information on Linux systems.

Open sourceFree
Be the first to rate
License
GPL-2.0
Latest version
B.02.20

What is lshw?

lshw has been part of the Linux ecosystem for many years, originally written in C and distributed with most major distributions. It reads the system’s BIOS, kernel, and hardware interfaces to produce a structured report of components such as CPU, memory, storage, network, and peripherals. The tool is aimed at sysadmins, developers, and power users who need a quick, scriptable way to audit hardware. It replaces GUI utilities like CPU‑Z by providing comparable data without a graphical interface. Compared to Windows tools, lshw feels more utilitarian: you run a command, get plain text or XML, and parse it. There’s no interactive UI, but the output is precise and can be fed into scripts or configuration management tools.

Best for: System administrators and developers who need accurate, scriptable hardware inventory on Linux.

Key features of lshw

  • Displays CPU, memory, storage, network, and peripheral details
  • Outputs in plain text, XML, or JSON
  • Can filter by class or logical name
  • Supports verbose mode for deeper inspection
  • Runs as root for full hardware access
  • Integrates with shell pipelines
  • Supports multiple output formats for automation

Pros

  • Free and open source
  • Available in all major distro repositories
  • No GUI overhead, fast execution
  • Scriptable for automation
  • Detailed hardware hierarchy
  • Supports XML/JSON for integration

Cons

  • Requires root for complete data
  • No graphical interface, steep learning curve for novices
  • Output can be verbose and hard to read
  • Limited to command line, no interactive filtering

Windows programs lshw replaces

How to install lshw on Linux

Ubuntu / Mintsudo apt install lshw
Debiansudo apt install lshw
Fedorasudo dnf install lshw
Arch / Manjarosudo pacman -S lshw
openSUSEsudo zypper install lshw

Tips for Windows users

If you’re used to CPU‑Z, note that lshw outputs plain text or XML; there are no file formats to import. Use lshw -short for a concise table similar to CPU‑Z’s summary. You can redirect output to a file with lshw > report.txt. Keyboard shortcuts are not applicable; instead, use command options like -class cpu or -numeric. The workflow shifts from a GUI to terminal commands, but you can pipe the output into tools like less or grep for easier viewing.

lshw: frequently asked questions

How do I install lshw on Ubuntu?

Run sudo apt install lshw. It is in the default repositories.

Can I run lshw without root?

You can run it as a normal user, but it will omit information that requires privileged access, such as detailed PCI data.

What output formats does lshw support?

Plain text, XML, and JSON. Use -xml or -json to get structured data.

Is lshw still maintained?

Yes, it is actively maintained and appears in the latest releases of major distributions.

Updated