Knowing how to view hardware on Linux from the command line is essential for troubleshooting, upgrades, or scripting. This guide shows practical, beginner-to-intermediate commands to view CPU, RAM, disk, network, BIOS/UEFI, and power information. Focus keywords such as Linux hardware commands, view hardware Linux, and lshw inxi dmidecode are used throughout to help you find this content quickly.
Prerequisites
Most inspection commands require either normal user access or elevated privileges. When a command needs root access, prefix it with sudo. sudo temporarily runs a command as the superuser; you will be prompted for your password. Install the common utilities below if your system doesn't have them.
Install diagnostic tools
sudo apt update && sudo apt install -y inxi lshw dmidecode hwinfo hdparm lsusb pciutils
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 inxi all 3.3.09-1 [68.3 kB] Get:2 http://archive.ubuntu.com/ubuntu focal/main amd64 lshw amd64 02.18-0.1 [198 kB] ... 0 upgraded, 7 newly installed, 0 to remove and 2 not upgraded. Need to get 1,234 kB of archives. After this operation, 5.8 MB of additional disk space will be used.
Why install these? Tools such as inxi, lshw, and dmidecode aggregate hardware details in readable formats; others (like hdparm) expose disk-specific information.
Hardware overview
Start with a quick overview that many forums request when helping diagnose machines.
All-in-one summary: inxi
inxi -Fxz
System: Host: mypc Kernel: 5.15.0-60-generic x86_64 bits: 64 Machine: Type: Desktop Mobo: ASUSTeK model: PRIME Z370-A v: Rev X.0x CPU: Info: 8-core Intel Core i7-8700K speed: 4200 MHz Graphics: Device-1: NVIDIA GP106 [GeForce GTX 1060 6GB] driver: nvidia Network: Device-1: Intel Ethernet I219-V Drives: Local Storage: total: 1.09 TiB
What it does: inxi collects hardware and some software information and masks sensitive data with the -z option.
Alternative: lshw and hwinfo
lshw -short
H/W path Device Class Description
===================================================
system ASUSTeK PRIME Z370-A
/0 bus 440BX/DX -type motherboard
/0/0 memory 16GiB System Memory
/0/100/1 processor Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
/0/100/14 ethernet Intel I219-Vhwinfo --short
cpu: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz disk: /dev/sda - 1TB Samsung SSD display: NVIDIA GeForce GTX 1060
Why use them: lshw gives structured, detailed hardware reports; hwinfo provides different formatting and additional probe data.
CPU details
To inspect CPU model, cores, architecture, and features:
lscpu
Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 6 On-line CPU(s) list: 0-5 Model name: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz CPU MHz: 3700.000
Explain: lscpu queries /proc/cpuinfo and prints human-readable CPU info. Use it to confirm architecture (32 vs 64-bit) and core count.
lshw -C cpu | grep -i product
product: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
lscpu | grep -i mhz
CPU MHz: 3700.000
Use grep -i to filter case-insensitively for specific fields (e.g., model, MHz, bogomips).
Memory (RAM)
dmidecode -t memory | grep -i size
Size: 8192 MB Size: 8192 MB Maximum Capacity: 64 GB
What it shows: dmidecode reads DMI/SMBIOS tables from the BIOS and reports module sizes and the system maximum (root required).
lshw -short -C memory
H/W path Device Class Description ------------------------------------------------ /0/0/0 memory 8192MiB DIMM DDR4 SODIMM 2400 MHz /0/0/1 memory 8192MiB DIMM DDR4 SODIMM 2400 MHz
lshw -short -C memory | grep -i empty
/0/0/2 memory empty DIMM slot 3
If the grep for empty returns nothing, all slots are populated. Use these outputs to determine whether you can add memory without opening the case.
Video memory (VRAM)
lspci | grep -i vga
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (rev 02)
lspci -v -s 00:02.0
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (rev 02) Subsystem: ASUSTeK Computer Inc. Device 8696 Memory at e0000000 (32-bit, prefetchable) [size=256M] Memory at f0000000 (32-bit, non-prefetchable) [size=16M]
Look for the prefetchable memory line; it typically displays the VRAM size exposed to the PCI subsystem.
Current memory usage
free -m
total used free shared buff/cache available Mem: 16384 256 15000 12 112 16080 Swap: 2048 0 2048
top -b -n 1 | head -n 12
top - 10:22:10 up 2:01, 2 users, load average: 0.08, 0.07, 0.01 Tasks: 193 total, 1 running, 192 sleeping, 0 stopped, 0 zombie %Cpu(s): 2.0 us, 1.0 sy, 0.0 ni, 96.5 id, 0.4 wa KiB Mem : 16384000 total, 262144 used, 16121856 free
Tip: Use free -m to see memory in megabytes. For continuous monitoring, run top (interactive); above we use a single snapshot with -b -n 1 to capture output non-interactively.
Disks, partitions, and filesystems
lshw -short -C disk
/0/1.0.0 /dev/sda disk 1TB Samsung SSD 860 /0/2.0.0 /dev/sdb disk 2TB Seagate HDD
hdparm -I /dev/sda
/dev/sda: Model Number: Samsung SSD 860 EVO 1TB Serial Number: S3Z6NB0K123456A Firmware Revision: RVT02B6Q Transport: Serial, ATA8-ACS T13/1699-D Revision 4
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 931.5G 0 disk ├─sda1 8:1 0 512M 0 part /boot/efi ├─sda2 8:2 0 930.5G 0 part / sdb 8:16 0 1.8T 0 disk └─sdb1 8:17 0 1.8T 0 part /mnt/storage
fdisk -l
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors Units: sectors of 1 * 512 = 512 bytes Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 1050623 1048576 512M 7 HPFS/NTFS/exFAT /dev/sda2 1050624 1953523711 1952473088 931G 83 Linux
blkid
/dev/sda1: UUID="3C1A-2F0A" TYPE="vfat" PARTLABEL="EFI system partition" /dev/sda2: UUID="e3a6f63d-1d2d-4a8f-9f0b-6a4f9e8a4bb8" TYPE="ext4"
df -m
Filesystem 1M-blocks Used Available Use% Mounted on /dev/sda2 907512 12432 824680 2% / tmpfs 8192 6 8186 1% /run
Notes: Use lsblk for a readable partition tree, fdisk -l for sector-level details, and blkid to find UUIDs used in /etc/fstab.
USB and PCI devices
lsusb
Bus 002 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver Bus 001 Device 002: ID 8087:0a2b Intel Corp.
lspci
00:00.0 Host bridge: Intel Corporation 8th Gen Core Host Bridge 00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 01:00.0 3D controller: NVIDIA Corporation GP106 [GeForce GTX 1060]
Use: lsusb shows connected USB devices; lspci lists PCI bus devices (GPUs, NICs, host bridges).
Networking
lshw -C network
*-network
description: Ethernet interface
product: Ethernet Connection (7) I219-V
vendor: Intel Corporation
logical name: enp3s0
serial: 3c:97:0e:12:34:56
capacity: 1Gbit/sip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 3c:97:0e:12:34:56 brd ff:ff:ff:ff:ff:ffip route | column -t
default via 192.168.1.1 dev enp3s0 proto dhcp metric 100 192.168.1.0 via 0.0.0.0 dev enp3s0 proto kernel scope link src 192.168.1.42
Why these: Replace legacy ifconfig with ip for modern networking management. Use lshw -C network to see hardware details and MAC addresses.
Firmware, kernel, and software info
dmidecode -t bios
DMI type 0, 24 bytes
BIOS Information
Vendor: American Megatrends Inc.
Version: 2402
Release Date: 07/15/2020uname -a
Linux mypc 5.15.0-60-generic #66-Ubuntu SMP Tue Oct 19 15:12:34 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Use: dmidecode -t bios reveals BIOS/UEFI vendor and version — useful before firmware upgrades. uname -a shows kernel version and architecture.
Power and kernel messages
acpi -b
Battery 0: Charging, 82%, 00:40:12 until charged
dmesg | tail -n 20
[ 3452.123456] usb 2-1: new full-speed USB device number 5 using xhci_hcd [ 3452.234567] usb 2-1: New USB device found, idVendor=046d, idProduct=c52b [ 3452.234571] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Why: acpi reports battery and thermal status. dmesg shows kernel-detected events (driver/boot messages) and is vital for diagnosing driver or device initialization issues.
Verification: a quick checklist
After running diagnostics, verify these items:
- CPU model and core count match expectations (lscpu).
- Installed RAM equals sum of memory modules (dmidecode, lshw).
- Disk sizes and partitions are correct (lsblk, fdisk -l).
- Network interfaces are up and have the right IP (ip link show, ip route).
- BIOS/UEFI version is current if you plan firmware upgrades (dmidecode -t bios).
Troubleshooting tips
Permissions and root access
If a command fails with permission denied, re-run with sudo. For persistent root sessions you can use sudo -i or switch to root with su - (if configured).
Missing tools
If a tool isn't installed, use your package manager. For Debian/Ubuntu:
sudo apt install inxi lshw dmidecode
Reading package lists... Done Building dependency tree... The following NEW packages will be installed: inxi lshw dmidecode 0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. Do you want to continue? [Y/n] Y
No output or incomplete fields
Some virtual machines or minimal environments hide physical hardware details. In VMs, tools might show virtualized or generic devices. If DMI reports are blank, ensure the host exposes them or check hypervisor settings.
Conflicting data between tools
Different tools read different sources: lshw probes sysfs and devices; dmidecode reads BIOS-supplied tables. Trust BIOS for manufactured values (serial numbers) and kernel sources (dmesg, /proc, /sys) for runtime device state.
Quick reference (common commands)
This mini-cheat sheet covers the essentials; run each command to see its paired output as shown above:
- inxi -Fxz — full system summary
- lshw -short — concise hardware list
- lscpu — CPU details
- dmidecode -t memory — RAM module info
- lspci / lsusb — PCI and USB devices
- lsblk, fdisk -l — disks and partitions
- blkid — UUIDs for fstab
- free -m, top — memory and process monitoring
- ip link show, ip route — network interfaces & routing
- dmidecode -t bios, uname -a — firmware & kernel
Conclusion
These Linux hardware commands let you view hardware Linux systems quickly and accurately. Whether you need a one-line summary with inxi, low-level BIOS details with dmidecode, or device lists via lshw and lspci, the commands above form a reliable toolkit for diagnostics, upgrades, and scripting. Repeat the verification checklist after changes and use the troubleshooting tips if output is missing or inconsistent.
