Understanding your system's hardware configuration is essential for developers and system administrators, whether you're verifying hardware compatibility, diagnosing performance issues, or planning upgrades. Linux provides several built-in tools to inspect and report detailed hardware information. This guide demonstrates how to use common Linux utilities to generate system hardware reports, interpret the collected data, and export it in different formats for documentation or troubleshooting. By the end, you'll have a script that generates and archives a complete hardware report for any Linux system.
The Short Answer Version
To quickly view your system's hardware details without generating full reports, use these commands:
$ sudo lshw -short
$ sudo inxi -Fxz
$ sudo dmidecode -t system
$ lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT
$ sudo hwinfo --short
-
sudo lshw -short— concise hardware tree -
sudo inxi -Fxz— readable system summary (serials redacted) -
sudo dmidecode -t system— BIOS/system info from firmware -
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT— disks/partitions at a glance -
sudo hwinfo --short— compact, per-device summary from kernel probes
1. Install Common Tools to Generate Hardware Reports
Most distributions include some of these tools by default, but you can install all of them using your package manager.
On Debian and Ubuntu
1. Update the package list and install the required tools:
$ sudo apt update
$ sudo apt install -y lshw inxi dmidecode hwinfo
On AlmaLinux, Rocky Linux, and RHEL
1. Enable the PowerTools repository:
$ sudo dnf config-manager --set-enabled powertools
For RHEL, the repository name differs. Enable the CodeReady Builder repository instead:
$ sudo dnf config-manager --set-enabled codeready-builder-for-rhel-$(rpm -E %rhel)-$(arch)-rpms
2. Install the perl-JSON-XS dependency:
$ sudo dnf install -y perl-JSON-XS
3. Install the hardware reporting tools:
$ sudo dnf install -y lshw inxi dmidecode hwinfo
Tools Overview
- lshw: Displays detailed information about all hardware components, including CPU, memory, storage, and network devices.
- inxi: Provides a summarized, human-readable system overview while hiding sensitive identifiers such as serial numbers.
- dmidecode: Retrieves hardware and BIOS information directly from system firmware (DMI tables).
- hwinfo: Offers comprehensive device-level data, useful for diagnostics and driver verification.
2. System Hardware Deep-Dive: Commands & Examples
CPU
1. View CPU architecture, model, core/thread count, and available instruction sets:
$ lscpu
Output:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 40 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Vendor ID: GenuineIntel
Model name: Intel Xeon Processor (Skylake, IBRS)
......
The lscpu utility gathers data from /proc/cpuinfo and system firmware. Key fields include Architecture (32-bit, 64-bit, or both), CPU(s) (total available logical cores), and Model name / Vendor ID (useful for identifying virtual CPUs in cloud environments).
Memory (RAM)
1. View real-time memory usage and swap utilization:
$ free -h
Output:
total used free shared buff/cache available
Mem: 7.7Gi 459Mi 6.2Gi 1.3Mi 1.3Gi 7.3Gi
Swap: 8.0Gi 0B 8.0Gi
The "available" field shows the total memory that applications can still use without swapping.
2. Retrieve detailed information about installed DIMMs from system firmware:
$ sudo dmidecode -t memory
Output:
# dmidecode 3.5
Getting SMBIOS data from sysfs.
SMBIOS 3.0.0 present.
Handle 0x1000, DMI type 16, 23 bytes
Physical Memory Array
Use: System Memory
Maximum Capacity: 8 GB
Number Of Devices: 1
Handle 0x1100, DMI type 17, 40 bytes
Memory Device
Array Handle: 0x1000
Size: 8 GB
Type: RAM
This extracts firmware-level data (DMI tables) that includes slot information, maximum capacity, and manufacturer details — useful for verifying the physical memory layout or identifying faulty modules.
Disks & Filesystems
1. List all block devices with their size, type, filesystem format, and mount location:
$ lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT
Output:
NAME SIZE TYPE FSTYPE MOUNTPOIN
sr0 1024M rom
vda 160G disk
├─vda1 512M part vfat /boot/efi
└─vda2 159.5G part ext4 /
Key fields: TYPE (physical disk, partition, or virtual block), FSTYPE (filesystem type, e.g. ext4, xfs, vfat), and MOUNTPOINT (where each partition is mounted). Append -f to lsblk to display filesystem UUIDs and labels.
2. Display mounted filesystems and usage statistics by type:
$ df -hT
Output:
Filesystem Type Size Used Avail Use% Mounted on
efivarfs efivarfs 256K 19K 233K 8% /sys/firmware/efi/efivars
/dev/vda2 ext4 328G 16G 298G 6% /
/dev/vda1 vfat 511M 6.2M 505M 2% /boot/efi
Key options: -h displays sizes in human-readable format, -T includes the filesystem type.
Network
1. List all network interfaces with assigned IP addresses:
$ ip -br addr
Output:
lo UNKNOWN 127.0.0.1/8 ::1/128
enp1s0 UP 192.2.0.56/23 2001:db8::5400:5ff:feb2:2f70/64
ip displays and manipulates network interfaces, routes, and addresses; -br enables brief mode; addr lists IP address information for each interface.
2. Display hardware-level details for network interfaces:
$ sudo lshw -class network
Output:
*-network
description: Ethernet controller
product: Virtio 1.0 network device
vendor: Red Hat, Inc.
......
capabilities: msix pm pciexpress bus_master cap_list fb
configuration: depth=32 driver=virtio-pci latency=0 mode=1280x800 visual=truecolor xres=1280 yres=800
resources: iomemory:80-7f irq:22 memory:85200000-85200fff memory:800000000-800003fff
*-virtio0
description: Ethernet interface
......
serial: 56:00:05:ba:75:dd
configuration: autonegotiation=off broadcast=yes driver=virtio_net driverversion=1.0.0 ip=155.138.194.201 link=yes multicast=yes
-class network filters lshw output to only show network-related devices.
Whole-System Summaries
1. Readable, redacted system summary:
$ inxi -Fxz
Output:
System:
Kernel: 6.8.0-79-generic arch: x86_64 bits: 64 compiler: gcc v: 13.3.0
Console: pty pts/4 Distro: Ubuntu 24.04.3 LTS (Noble Numbat)
Machine:
Type: Microsoft System: Cloud-VM product: Standard-PC v: pc-q35-8.2 serial: <superuser required>
Mobo: N/A model: N/A serial: N/A UEFI: Generic v: N/A date: N/A
CPU:
Info: quad core model: Intel Xeon (Cascadelake) bits: 64 type: MT MCP arch: Cascade Lake rev: 6
cache: L1: 512 KiB L2: 16 MiB L3: 16 MiB
Speed (MHz): avg: 2993 min/max: N/A cores: 1: 2993 2: 2993 3: 2993 4: 2993 5: 2993 6: 2993
7: 2993 8: 2993 bogomips: 47887
......
-F displays full system information (CPU, memory, disks, network, etc.), -x adds extra details like kernel and driver versions, and -z redacts sensitive information (serial numbers, MACs, etc.) for safe sharing.
2. View hardware tree (complete system details):
$ sudo lshw
Output:
demo-server
description: Computer
product: Standard-PC
vendor: Generic
version: pc-q35-8.2
serial: 89766525
width: 64 bits
capabilities: smbios-3.0.0 dmi-3.0.0 smp vsyscall32
sudo ensures access to restricted firmware and system data; lshw generates a detailed, hierarchical view of all detected hardware.
3. Compact high-level snapshot of hardware components:
$ sudo hwinfo --short
hwinfo probes and lists system hardware components; --short summarizes output into concise, per-device lines.
3. Exporting Hardware Reports
This section scripts the data collection using lshw, inxi, dmidecode, and hwinfo, storing the output in a timestamped directory. It captures hostname, kernel version, operating system, CPU information, memory usage, and network configuration.
1. Create a new shell script file:
$ nano generate-hw-reports.sh
2. Add the following script to the file. It collects detailed hardware information, organizes the reports, and compresses them into an archive:
#!/usr/bin/env bash
set -euo pipefail
TS=$(date +"%Y-%m-%dT%H-%M-%S")
HOSTNAME=$(hostname)
REPORT_DIR="hwreports-${HOSTNAME}-${TS}"
echo "==> Creating report directory: ${REPORT_DIR}"
mkdir -p "${REPORT_DIR}"
echo "==> Capturing basic system and network information"
ip route show > "${REPORT_DIR}/routes.txt"
cat /etc/resolv.conf > "${REPORT_DIR}/dns-config.txt"
sudo dmidecode -t bios > "${REPORT_DIR}/bios-info.txt"
uname -a > "${REPORT_DIR}/kernel.txt"
lsb_release -a > "${REPORT_DIR}/os-release.txt" 2>/dev/null || cat /etc/os-release > "${REPORT_DIR}/os-release.txt"
sudo dmidecode -t chassis > "${REPORT_DIR}/chassis.txt"
{
echo "System Hardware Report"
echo "======================="
echo "Host: ${HOSTNAME}"
echo "Generated on: ${TS}"
echo
echo "Files included:"
find "${REPORT_DIR}" -type f | sed 's|^| - |'
} > "${REPORT_DIR}/INDEX.txt"
cat <<EOF > "${REPORT_DIR}/metadata.json"
{
"hostname": "${HOSTNAME}",
"timestamp": "${TS}",
"kernel": "$(uname -r)",
"os": "$(grep PRETTY_NAME /etc/os-release | cut -d= -f2 | tr -d '"')",
"cpu_count": "$(nproc)",
"cpu_model": "$(lscpu | awk -F: '/Model name/ {print $2}' | xargs)",
"total_memory": "$(free -h | awk '/Mem:/ {print $2}')"
}
EOF
echo "==> Generating human-readable summary (inxi)"
inxi -Fxz > "${REPORT_DIR}/system-summary.txt"
echo "==> Generating hardware tree reports (lshw)"
sudo lshw -sanitize > "${REPORT_DIR}/lshw.txt"
sudo lshw -sanitize -html > "${REPORT_DIR}/lshw.html"
sudo lshw -sanitize -json > "${REPORT_DIR}/lshw.json"
echo "==> Dumping firmware/DMI data (dmidecode)"
sudo dmidecode > "${REPORT_DIR}/dmidecode.txt"
echo "==> Capturing component-specific snapshots"
lscpu > "${REPORT_DIR}/cpu.txt"
free -h > "${REPORT_DIR}/memory-usage.txt"
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT > "${REPORT_DIR}/disks.txt"
ip -br addr > "${REPORT_DIR}/net-addr.txt"
echo "==> Generating full hwinfo report (large)"
sudo hwinfo --all > "${REPORT_DIR}/hwinfo-full.txt"
sudo hwinfo --short > "${REPORT_DIR}/hwinfo-short.txt"
echo "==> Compressing reports into archive"
tar -czf "${REPORT_DIR}.tar.gz" "${REPORT_DIR}/"
echo "==> Done! Archive: ${REPORT_DIR}.tar.gz"
echo " To extract: tar -xzf ${REPORT_DIR}.tar.gz"
Save and close the file.
3. Grant execute permissions to the script:
$ chmod +x generate-hw-reports.sh
4. Run the script to generate the hardware reports:
$ ./generate-hw-reports.sh
Output:
==> Creating report directory: hwreports-K8s-Cluster-Master--01-2025-10-28T18-06-29
==> Capturing basic system and network information
==> Generating human-readable summary (inxi)
The script creates a timestamped directory containing all hardware reports, then compresses it into a .tar.gz archive for easy backup or sharing.
This script uses
-sanitize(forlshw) and-z(forinxi) to remove serial numbers and MAC addresses from the output. Review the generated files before sharing them if your environment treats device IDs or hostnames as sensitive data.
Next Steps
- Schedule the script with cron to generate hardware reports on a regular cadence for drift detection.
- Diff successive reports to catch unexpected hardware or firmware changes over time.
- Feed the
metadata.jsonoutput into a configuration management database (CMDB) or inventory tool. - Extend the script to capture GPU details with
nvidia-smiorlspcion systems with dedicated accelerators.
For the full guide with additional tips, visit the original article on Vultr Docs.
Top comments (0)