How to list hardware information in Linux

In this tutorial you are going to learn how to list hardware information in Linux. There are various commands that can be used in Linux to list or display hardware information.

Some of these commands include;

  • lscpu
  • lsusb
  • lsblk
  • lspci
  • hwinfo
  • lshw
  • lsmem
  • lsscsi

Let us know see how you can use these commands to list hardware information in Linux using the above commands;

How to list hardware information in Linux

1. lscpu

This command will display all your CPU information e.g. Architecture, CPU op-mode(s), Byte Order, Address sizes, Model, Model name, Vendor ID etc.

lscpu
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   45 bits physical, 48 bits virtual
CPU(s):                          2
On-line CPU(s) list:             0,1
Thread(s) per core:              1
Core(s) per socket:              1
Socket(s):                       2
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           44
Model name:                      Intel(R) Xeon(R) CPU           W3680  @ 3.33GHz
Stepping:                        2
CPU MHz:                         3333.339
BogoMIPS:                        6666.67
Hypervisor vendor:               VMware
Virtualization type:             full
L1d cache:                       64 KiB
L1i cache:                       64 KiB
L2 cache:                        512 KiB
L3 cache:                        24 MiB
NUMA node0 CPU(s):               0,1
Vulnerability Itlb multihit:     KVM: Mitigation: VMX unsupported
Vulnerability L1tf:              Mitigation; PTE Inversion
Vulnerability Mds:               Vulnerable: Clear CPU buffers attempted, no microcode; SMT
                                  Host state unknown
Vulnerability Meltdown:          Mitigation; PTI
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl an
                                 d seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sa
                                 nitization
Vulnerability Spectre v2:        Mitigation; Full generic retpoline, IBPB conditional, IBRS
                                 _FW, STIBP disabled, RSB filling
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca c
                                 mov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp 
                                 lm constant_tsc arch_perfmon nopl xtopology tsc_reliable n
                                 onstop_tsc cpuid pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2
                                 apic popcnt tsc_deadline_timer aes hypervisor lahf_lm pti 
                                 ssbd ibrs ibpb stibp tsc_adjust arat flush_l1d arch_capabi
                                 lities

2. lsusb

This command will display all your USB controllers information and details about devices connected to them.

lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

3. lsblk

This command will display block device information e.g. your hard drives and their partitions also other storage devices like flash disks

lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0     4K  1 loop /snap/bare/5
loop1    7:1    0  55.5M  1 loop /snap/core18/2246
loop2    7:2    0    55M  1 loop /snap/core18/1705
loop3    7:3    0 240.8M  1 loop /snap/gnome-3-34-1804/24
loop4    7:4    0   219M  1 loop /snap/gnome-3-34-1804/72
loop5    7:5    0  62.1M  1 loop /snap/gtk-common-themes/1506
loop6    7:6    0  65.2M  1 loop /snap/gtk-common-themes/1519
loop7    7:7    0  49.8M  1 loop /snap/snap-store/433
loop8    7:8    0    51M  1 loop /snap/snap-store/547
loop9    7:9    0  32.5M  1 loop /snap/snapd/13640
loop11   7:11   0  42.2M  1 loop /snap/snapd/13831
sda      8:0    0    15G  0 disk 
├─sda1   8:1    0   512M  0 part /boot/efi
├─sda2   8:2    0     1K  0 part 
└─sda5   8:5    0  14.5G  0 part /
sr0     11:0    1  1024M  0 rom 

4. lspci

This command will display information about pci buses and details about devices connected to it.

lspci
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)
00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10)
00:0f.0 VGA compatible controller: VMware SVGA II Adapter
00:10.0 SCSI storage controller: Broadcom / LSI 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
00:11.0 PCI bridge: VMware PCI bridge (rev 02)
00:15.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.7 PCI bridge: VMware PCI Express Root Port (rev 01)
02:00.0 USB controller: VMware USB1.1 UHCI Controller
02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
02:02.0 Multimedia audio controller: Ensoniq ES1371/ES1373 / Creative Labs CT2518 (rev 02)
02:03.0 USB controller: VMware USB2 EHCI Controller
02:05.0 SATA controller: VMware SATA AHCI controller

To see details about each connected device, use the following command

lspci -v    
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
	Subsystem: VMware Virtual Machine Chipset
	Flags: bus master, medium devsel, latency 0
	Kernel driver in use: agpgart-intel

00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01) (prog-if 00 [Normal decode])
	Flags: bus master, 66MHz, medium devsel, latency 0
	Bus: primary=00, secondary=01, subordinate=01, sec-latency=64
	I/O behind bridge: [disabled]
	Memory behind bridge: [disabled]
	Prefetchable memory behind bridge: [disabled]

00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
	Subsystem: VMware Virtual Machine Chipset
	Flags: bus master, medium devsel, latency 0

00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01) (prog-if 8a [ISA Compatibility mode controller, supports both channels switched to PCI native mode, supports bus mastering])
	Subsystem: VMware Virtual Machine Chipset
	Flags: bus master, medium devsel, latency 64
	Memory at 000001f0 (32-bit, non-prefetchable) [virtual] [size=8]
	Memory at 000003f0 (type 3, non-prefetchable) [virtual]
	Memory at 00000170 (32-bit, non-prefetchable) [virtual] [size=8]
	Memory at 00000370 (type 3, non-prefetchable) [virtual]
	I/O ports at 1060 [virtual] [size=16]
	Kernel driver in use: ata_piix
	Kernel modules: pata_acpi

00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
	Subsystem: VMware Virtual Machine Chipset
	Flags: medium devsel, IRQ 9
	Kernel modules: i2c_piix4

00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10)
	Subsystem: VMware Virtual Machine Communication Interface
	Flags: bus master, medium devsel, latency 64, IRQ 16
	I/O ports at 1080 [size=64]
	Memory at febfe000 (64-bit, non-prefetchable) [size=8K]
	Capabilities: 
	Kernel driver in use: vmw_vmci
	Kernel modules: vmw_vmci

00:0f.0 VGA compatible controller: VMware SVGA II Adapter (prog-if 00 [VGA controller])
	Subsystem: VMware SVGA II Adapter
	Flags: bus master, medium devsel, latency 64, IRQ 16
	I/O ports at 1070 [size=16]
	Memory at e8000000 (32-bit, prefetchable) [size=128M]
	Memory at fe000000 (32-bit, non-prefetchable) [size=8M]
	Expansion ROM at 000c0000 [virtual] [disabled] [size=128K]
	Capabilities: 
	Kernel driver in use: vmwgfx
	Kernel modules: vmwgfx

00:10.0 SCSI storage controller: Broadcom / LSI 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
	Subsystem: VMware LSI Logic Parallel SCSI Controller
	Flags: bus master, medium devsel, latency 64, IRQ 17
	I/O ports at 1400 [size=256]
	Memory at feba0000 (64-bit, non-prefetchable) [size=128K]
	Memory at febc0000 (64-bit, non-prefetchable) [size=128K]
	Expansion ROM at c0008000 [virtual] [disabled] [size=16K]
	Capabilities: 
	Kernel driver in use: mptspi
	Kernel modules: mptspi

5. hwinfo

This command will display details about different hardware components.

To display brief information about hardware components, run the following command

hwinfo --short     
cpu:                                                            
                       Intel(R) Xeon(R) CPU           W3680  @ 3.33GHz, 3333 MHz
                       Intel(R) Xeon(R) CPU           W3680  @ 3.33GHz, 3333 MHz
keyboard:
  /dev/input/event1    AT Translated Set 2 keyboard
mouse:
  /dev/input/mice      VMware Virtual Mouse
  /dev/input/mice      VirtualPS/2 VMware VMMouse
  /dev/input/mice      VirtualPS/2 VMware VMMouse
graphics card:
                       VMware VMWARE0405
sound:
                       Ensoniq Audio PCI 64V/128/5200 / Creative CT4810/CT5803/CT5806 [Sound Blaster PCI]
storage:
                       VMware LSI Logic Parallel SCSI Controller
                       VMware SATA AHCI controller
                       VMware Virtual Machine Chipset
network:
  ens33                VMware PRO/1000 MT Single Port Adapter
network interface:
  lo                   Loopback network interface
  ens33                Ethernet network interface
disk:
  /dev/sda             VMware Virtual S
partition:
  /dev/sda1            Partition
  /dev/sda2            Partition
  /dev/sda5            Partition
cdrom:
  /dev/sr0             NECVMWar VMware SATA CD01
usb controller:
                       VMware USB1.1 UHCI Controller
                       VMware USB2 EHCI Controller
bios:
                       BIOS
bridge:
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       Intel 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware Virtual Machine Chipset
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware Virtual Machine Chipset
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware Virtual Machine Chipset
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI bridge
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
                       VMware PCI Express Root Port
hub:
                       VMware Virtual USB Hub
                       Linux Foundation 2.0 root hub
                       Linux Foundation 1.1 root hub
memory:
                       Main Memory
unknown:
                       FPU
                       DMA controller
                       PIC
                       Keyboard controller
                       VMware Virtual Machine Communication Interface
                       Serial controller

To display CPU information only, run the following command

hwinfo --short --cpu
cpu:                                                            
                       Intel(R) Xeon(R) CPU           W3680  @ 3.33GHz, 3333 MHz
                       Intel(R) Xeon(R) CPU           W3680  @ 3.33GHz, 3333 MHz

To display network card information only, run the following command

hwinfo --short --netcard
network:                                                        
  ens33                VMware PRO/1000 MT Single Port Adapter

To display usb devices and controllers only, run the following command

hwinfo --short --usb
mouse:                                                          
  /dev/input/mice      VMware Virtual Mouse
hub:
                       VMware Virtual USB Hub
                       Linux Foundation 2.0 root hub
                       Linux Foundation 1.1 root hub

To display several hardware e.g. cpu & usb at once. run the following command

hwinfo --short --cpu --usb --block  
cpu:                                                            
                       Intel(R) Xeon(R) CPU           W3680  @ 3.33GHz, 3333 MHz
                       Intel(R) Xeon(R) CPU           W3680  @ 3.33GHz, 3333 MHz
mouse:
  /dev/input/mice      VMware Virtual Mouse
disk:
  /dev/sda             VMware Virtual S
partition:
  /dev/sda1            Partition
  /dev/sda2            Partition
  /dev/sda5            Partition
cdrom:
  /dev/sr0             NECVMWar VMware SATA CD01
hub:
                       VMware Virtual USB Hub
                       Linux Foundation 2.0 root hub
                       Linux Foundation 1.1 root hub

6. lshw

This command will display detailed information about several hardware units such as motherboard, CPU, PCI etc. The command needs to be run as root (super user) so as to get all the information i.e.

sudo lshw    

To display brief information, run the following command

lshw --short    
Hardware Lister (lshw) - 
usage: lshw [-format] [-options ...]
       lshw -version

	-version        print program version ()

format can be
	-html           output hardware tree as HTML
	-xml            output hardware tree as XML
	-json           output hardware tree as a JSON object
	-short          output hardware paths
	-businfo        output bus information

options can be
	-class CLASS    only show a certain class of hardware
	-C CLASS        same as '-class CLASS'
	-c CLASS        same as '-class CLASS'
	-disable TEST   disable a test (like pci, isapnp, cpuid, etc. )
	-enable TEST    enable a test (like pci, isapnp, cpuid, etc. )
	-quiet          don't display status
	-sanitize       sanitize output (remove sensitive information like serial numbers, etc.)
	-numeric        output numeric IDs (for PCI, USB, etc.)
	-notime         exclude volatile attributes (timestamps) from output

7. lsmem

To display memory information, run the following command.

lsmem  
RANGE                                 SIZE  STATE REMOVABLE BLOCK
0x0000000000000000-0x00000000bfffffff   3G online       yes  0-23
0x0000000100000000-0x000000013fffffff   1G online       yes 32-39

Memory block size:       128M
Total online memory:       4G
Total offline memory:      0B

8. lsscsi

Is used to display all scsi/sata devices like hard drives and optical drives. To run it start by installing the lsscsi tool first by running the following command.

sudo apt install lsscsi

  …and then you can run the command now.

lsscsi
[3:0:0:0]    cd/dvd  NECVMWar VMware SATA CD01 1.00  /dev/sr0 
[32:0:0:0]   disk    VMware,  VMware Virtual S 1.0   /dev/sda

To display device size, run the following command

lsscsi -s    
[3:0:0:0]    cd/dvd  NECVMWar VMware SATA CD01 1.00  /dev/sr0        -
[32:0:0:0]   disk    VMware,  VMware Virtual S 1.0   /dev/sda   16.1GB

And that concludes our guide on how to list hardware information in Linux.

Read More

Read more on individual command man pages:

  • man lscpu
  • man lsusb
  • man lsblk
  • man lspci
  • man hwinfo
  • man lshw
  • man lsmem
  • man lsscsi

Other Tutorials

Use Find Command to locate files older than specific time in Linux

Use find command to locate files newer than specific time in Linux

System administrator | Software Developer | DevOps

Leave a Comment