Learn how to – Check Computer Hardware information on Linux using lshw.
Today I will share with you a tool that can help you check your hardware components and its core configuration settings. This tool is available for all Linux Distributions; Redhat, Centos, Ubuntu, Debian, Solaris, Arch Linux and others. It is a Linux hardware utility which gives detailed information about the hardware installed on your machine.
The name of the utility is lshw. lshw is a small tool to extract detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc. on DMI-capable x86 or IA-64 systems and on some PowerPC machines (PowerMac G4 is known to work).
There are other ways you can see hardware configuration of your Linux system like;
- /proc directory, and use of
- lspci: lspci is a utility for displaying information about PCI buses in the system and devices connected to them. By default, it shows a brief list of devices.
Installing lshw package on Linux
The lshw utility is not shipped with base Linux installation. We’ll need to install the package manually and start using it.
Debian / Ubuntu:
sudo apt update
sudo apt install lshw
CentOS / Fedora / RHEL / Rocky / AlmaLinux
sudo yum -y install lshw
Arch / Manjaro / Garuda / EndeavourOS
sudo pacman -Syy lshw
Check Computer Hardware information on Linux using lshw
After installation of lshw tool, we can now use it to check our computer hardware information. The most used command options and formats are:
- -version – print program version
- -html output hardware tree as HTML
- -xml output hardware tree as XML
- -json output hardware tree as a JSON object
- -businfo output bus information
- -short output hardware paths
Let’s consider some examples to demonstrate how this utility works.
Output bus information:
$ sudo lshw -businfo
Bus info Device Class Description
=======================================================
system OpenStack Compute
bus Motherboard
memory 96KiB BIOS
cpu@0 processor Intel Core Processor (Haswell, no TSX, IBRS)
cpu@1 processor Intel Core Processor (Haswell, no TSX, IBRS)
cpu@2 processor Intel Core Processor (Haswell, no TSX, IBRS)
cpu@3 processor Intel Core Processor (Haswell, no TSX, IBRS)
memory 8GiB System Memory
memory 8GiB DIMM RAM
pci@0000:00:00.0 bridge 440FX - 82441FX PMC [Natoma]
pci@0000:00:01.0 bridge 82371SB PIIX3 ISA [Natoma/Triton II]
communication PnP device PNP0501
input PnP device PNP0303
input PnP device PNP0f13
storage PnP device PNP0700
system PnP device PNP0b00
pci@0000:00:01.1 storage 82371SB PIIX3 IDE [Natoma/Triton II]
pci@0000:00:01.2 bus 82371SB PIIX3 USB [Natoma/Triton II]
usb@1 usb1 bus UHCI Host Controller
usb@1:1 input5 input QEMU QEMU USB Tablet
pci@0000:00:01.3 bridge 82371AB/EB/MB PIIX4 ACPI
pci@0000:00:02.0 /dev/fb0 display GD 5446
pci@0000:00:03.0 network Virtio network device
virtio@0 eth0 network Ethernet interface
pci@0000:00:04.0 storage Virtio block device
virtio@1 /dev/vda disk 42GB Virtual I/O device
virtio@1,1 /dev/vda1 volume 1GiB Linux swap volume
virtio@1,2 /dev/vda2 volume 38GiB Linux filesystem partition
pci@0000:00:05.0 generic Virtio memory balloon
virtio@2 generic Virtual I/O device
pci@0000:00:06.0 generic Virtio RNG
virtio@3 generic Virtual I/O device
input0 input Power Button
input1 input AT Translated Set 2 keyboard
input3 input VirtualPS/2 VMware VMMouse
input4 input VirtualPS/2 VMware VMMouse
input6 input PC Speaker
Output hardware paths:
$ sudo lshw -short
H/W path Device Class Description
=====================================================
system OpenStack Compute
/0 bus Motherboard
/0/0 memory 96KiB BIOS
/0/400 processor Intel Core Processor (Haswell, no TSX, IBRS)
/0/401 processor Intel Core Processor (Haswell, no TSX, IBRS)
/0/402 processor Intel Core Processor (Haswell, no TSX, IBRS)
/0/403 processor Intel Core Processor (Haswell, no TSX, IBRS)
/0/1000 memory 8GiB System Memory
/0/1000/0 memory 8GiB DIMM RAM
/0/100 bridge 440FX - 82441FX PMC [Natoma]
/0/100/1 bridge 82371SB PIIX3 ISA [Natoma/Triton II]
/0/100/1/0 communication PnP device PNP0501
/0/100/1/1 input PnP device PNP0303
/0/100/1/2 input PnP device PNP0f13
/0/100/1/3 storage PnP device PNP0700
/0/100/1/4 system PnP device PNP0b00
/0/100/1.1 storage 82371SB PIIX3 IDE [Natoma/Triton II]
/0/100/1.2 bus 82371SB PIIX3 USB [Natoma/Triton II]
/0/100/1.2/1 usb1 bus UHCI Host Controller
/0/100/1.2/1/1 input5 input QEMU QEMU USB Tablet
/0/100/1.3 bridge 82371AB/EB/MB PIIX4 ACPI
/0/100/2 /dev/fb0 display GD 5446
/0/100/3 network Virtio network device
/0/100/3/0 eth0 network Ethernet interface
/0/100/4 storage Virtio block device
/0/100/4/0 /dev/vda disk 42GB Virtual I/O device
/0/100/4/0/1 /dev/vda1 volume 1GiB Linux swap volume
/0/100/4/0/2 /dev/vda2 volume 38GiB Linux filesystem partition
/0/100/5 generic Virtio memory balloon
/0/100/5/0 generic Virtual I/O device
/0/100/6 generic Virtio RNG
/0/100/6/0 generic Virtual I/O device
/1 input0 input Power Button
/2 input1 input AT Translated Set 2 keyboard
/3 input3 input VirtualPS/2 VMware VMMouse
/4 input4 input VirtualPS/2 VMware VMMouse
/5 input6 input PC Speaker
Print output in:
HTML:
sudo lshw -html
JSON:
sudo lshw -json
XML:
sudo lshw -xml
Leave a Reply
You must be logged in to post a comment.