When you take over the administration of an undocumented, bare-metal Linux server, you need to know exactly what hardware is physically bolted to the motherboard. Relying on basic commands like free -m for RAM or lscpu for the processor leaves massive blind spots regarding your network cards, disk controllers, and motherboard firmware. To generate a complete, highly detailed manifest of every single silicon component inside the chassis, you must use the lshw (List Hardware) command.
How to Generate a Complete Hardware Report
The lshw command reads data directly from the kernel’s virtual filesystems (like /proc and /sys) and probes the PCI and USB buses. Because querying low-level hardware requires root privileges, you must always run this command with sudo.
sudo lshw
When you press Enter, the terminal will output a massive, sprawling tree of data. It starts at the core of the system (the Motherboard/Chassis) and branches outward. For example, under the “Memory” branch, it will not just tell you that you have 16GB of RAM; it will explicitly list the manufacturer, the clock speed (e.g., 3200MHz), and the exact physical slot on the motherboard where the stick is seated.
How to Filter for Specific Components
The default output of lshw is often hundreds of lines long, making it difficult to read in the terminal. You can use the -C (Class) flag to forcefully filter the output, instructing the command to only display a specific category of hardware.
If you only want to see the details of your physical hard drives and storage controllers, run:
sudo lshw -C disk
If you are troubleshooting a network issue and need to find the exact MAC address and driver module of your Ethernet card, run:
sudo lshw -C network
This targeted approach cuts out the noise and instantly delivers the exact specifications you need to download the correct drivers.
Exporting Hardware Data for Documentation
If you are auditing a server rack and need to save this hardware manifest for your company’s IT records, you should not copy and paste the terminal output. The lshw command has built-in export flags that format the data perfectly for documentation.
To export the entire hardware manifest as a beautifully formatted webpage that you can open in any browser, run:
sudo lshw -html > hardware_audit.html
Alternatively, if you want to import the data into an inventory management database or an automated monitoring script, you can export it as a highly structured JSON file:
sudo lshw -json > hardware_audit.json