Overview
These three commands form the essential toolkit for discovering and documenting hardware on Linux systems. Together they provide a complete picture of your system's processors, internal devices, and peripherals. Whether you're troubleshooting driver issues, planning upgrades, or documenting infrastructure, these commands are your first stop.
Why These Commands Together?
- lscpu - Reveals CPU architecture, cores, threads, cache, and virtualization capabilities
- lspci - Shows all PCI/PCIe devices: graphics, network, storage controllers, bridges
- lsusb - Lists USB devices and controllers with vendor/product IDs
Combined, they give you a complete hardware inventory without opening the case.
Synopsis
lscpu [OPTIONS]
Description
The lscpu command gathers CPU architecture information from sysfs, /proc/cpuinfo, and various kernel interfaces. It displays information about CPU cores, threads, sockets, NUMA nodes, caches, and supported instruction sets. This is invaluable for understanding processor capabilities, planning virtualization, and troubleshooting performance issues.
Common lscpu Options
| Option |
Description |
| -a, --all |
Include lines for online and offline CPUs (default for -e) |
| -e, --extended |
Display in extended readable format |
| -p, --parse |
Print in parseable format (useful for scripting) |
| -J, --json |
Output in JSON format |
| -y, --physical |
Display physical IDs |
lscpu Examples
Example 1: Basic CPU Information
Display comprehensive CPU architecture details for the system.
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 39 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Vendor ID: GenuineIntel
Model name: Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
CPU family: 6
Model: 158
Thread(s) per core: 1
Core(s) per socket: 8
Socket(s): 1
Stepping: 12
CPU max MHz: 4900.0000
CPU min MHz: 800.0000
BogoMIPS: 7200.00
Virtualization features:
Virtualization: VT-x
Caches (sum of all):
L1d: 256 KiB (8 instances)
L1i: 256 KiB (8 instances)
L2: 2 MiB (8 instances)
L3: 12 MiB (1 instance)
NUMA:
NUMA node(s): 1
NUMA node0 CPU(s): 0-7
Vulnerabilities:
Itlb multihit: KVM: Mitigation: VMX disabled
L1tf: Not affected
Mds: Not affected
Meltdown: Not affected
Spec store bypass: Mitigation; Speculative Store Bypass disabled
Spectre v1: Mitigation; usercopy/swapgs barriers
Spectre v2: Mitigation; Enhanced IBRS, IBPB: conditional
Key Information Revealed:
- 8 cores, 1 thread per core = no hyperthreading
- VT-x enabled = can run virtual machines
- CPU can scale from 800 MHz to 4.9 GHz
- 12 MB L3 cache shared across cores
- Security vulnerabilities and mitigations
Example 2: Extended CPU Topology View
Show detailed per-CPU information including cache hierarchy.
$ lscpu --extended
CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE MAXMHZ MINMHZ
0 0 0 0 0:0:0:0 yes 4900.0000 800.0000
1 0 0 1 1:1:1:0 yes 4900.0000 800.0000
2 0 0 2 2:2:2:0 yes 4900.0000 800.0000
3 0 0 3 3:3:3:0 yes 4900.0000 800.0000
4 0 0 4 4:4:4:0 yes 4900.0000 800.0000
5 0 0 5 5:5:5:0 yes 4900.0000 800.0000
6 0 0 6 6:6:6:0 yes 4900.0000 800.0000
7 0 0 7 7:7:7:0 yes 4900.0000 800.0000
Reading the Cache Column: The L1d:L1i:L2:L3 notation shows which cache instance each CPU uses. All cores share L3 cache instance 0, but each has its own L1 and L2 caches.
Example 3: Parseable Format for Scripts
Extract specific CPU information for use in automation scripts.
$ lscpu --parse=CPU,CORE,SOCKET,NODE
# The following is the parseable format, which can be fed to other
# programs. Each different item in every column has an unique ID
# starting from zero.
# CPU,CORE,SOCKET,NODE
0,0,0,0
1,1,0,0
2,2,0,0
3,3,0,0
4,4,0,0
5,5,0,0
6,6,0,0
7,7,0,0
# Get total number of cores
$ lscpu --parse=CORE | grep -v '^#' | sort -u | wc -l
8
# Get physical CPU count
$ lscpu --parse=SOCKET | grep -v '^#' | sort -u | wc -l
1
Scripting Tip: The parseable format is perfect for inventory scripts and configuration management tools like Ansible or Puppet.
Synopsis
lspci [OPTIONS]
Description
The lspci command lists all PCI (Peripheral Component Interconnect) devices in the system. This includes graphics cards, network adapters, storage controllers, USB controllers, and internal bridges. It queries the PCI configuration space and matches device IDs against the PCI ID database to show human-readable names. Essential for driver troubleshooting and hardware documentation.
Common lspci Options
| Option |
Description |
| -v, -vv, -vvv |
Increase verbosity (detailed, very detailed, extremely detailed) |
| -k |
Show kernel drivers handling each device |
| -nn |
Show both textual and numeric ID's (vendor:device) |
| -t |
Show PCI bus tree |
| -s [[[[<domain>]:]<bus>]:][<slot>][.[<func>]] |
Show only specific device |
| -d [<vendor>]:[<device>] |
Show only devices with specified vendor/device ID |
lspci Examples
Example 4: List All PCI Devices
Basic listing of all PCI devices in the system.
$ lspci
00:00.0 Host bridge: Intel Corporation 8th Gen Core Processor Host Bridge/DRAM Registers (rev 07)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (rev 07)
00:14.0 USB controller: Intel Corporation 200 Series/Z370 Chipset Family USB 3.0 xHCI Controller
00:16.0 Communication controller: Intel Corporation 200 Series PCH CSME HECI #1
00:17.0 SATA controller: Intel Corporation 200 Series PCH SATA controller [AHCI mode]
00:1c.0 PCI bridge: Intel Corporation 200 Series PCH PCI Express Root Port #1 (rev f0)
00:1f.0 ISA bridge: Intel Corporation Z370 Chipset LPC/eSPI Controller
00:1f.2 Memory controller: Intel Corporation 200 Series/Z370 Chipset Family Power Management Controller
00:1f.3 Audio device: Intel Corporation 200 Series PCH HD Audio
00:1f.4 SMBus: Intel Corporation 200 Series/Z370 Chipset Family SMBus Controller
01:00.0 VGA compatible controller: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GP106 High Definition Audio Controller (rev a1)
02:00.0 Ethernet controller: Intel Corporation I219-V Gigabit Network Connection (rev 04)
Reading the Format: Each line shows [bus:device.function] followed by device class and description. The bus number increases as you go through bridges to expansion cards.
Example 5: Show Kernel Drivers in Use
Identify which kernel module is handling each device - critical for troubleshooting.
$ lspci -k
00:17.0 SATA controller: Intel Corporation 200 Series PCH SATA controller [AHCI mode]
Subsystem: ASUSTeK Computer Inc. 200 Series PCH SATA controller [AHCI mode]
Kernel driver in use: ahci
Kernel modules: ahci
00:1f.3 Audio device: Intel Corporation 200 Series PCH HD Audio
Subsystem: ASUSTeK Computer Inc. 200 Series PCH HD Audio
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel
01:00.0 VGA compatible controller: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] (rev a1)
Subsystem: Micro-Star International Co., Ltd. [MSI] GP106 [GeForce GTX 1060 6GB]
Kernel driver in use: nvidia
Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia
02:00.0 Ethernet controller: Intel Corporation I219-V Gigabit Network Connection (rev 04)
Subsystem: ASUSTeK Computer Inc. I219-V Gigabit Network Connection
Kernel driver in use: e1000e
Kernel modules: e1000e
Driver Conflicts: If you see "Kernel modules:" listing multiple drivers but "Kernel driver in use:" showing none, you likely have a driver problem. The NVIDIA line above shows nouveau, nvidia, and nvidia_drm available, but nvidia actively in use.
Example 6: Detailed Device Information with Vendor IDs
Show verbose information including vendor/device IDs for hardware database lookups.
$ lspci -vnn -s 01:00.0
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] [10de:1c03] (rev a1) (prog-if 00 [VGA controller])
Subsystem: Micro-Star International Co., Ltd. [MSI] GP106 [GeForce GTX 1060 6GB] [1462:3283]
Flags: bus master, fast devsel, latency 0, IRQ 130
Memory at de000000 (32-bit, non-prefetchable) [size=16M]
Memory at c0000000 (64-bit, prefetchable) [size=256M]
Memory at d0000000 (64-bit, prefetchable) [size=32M]
I/O ports at e000 [size=128]
Expansion ROM at 000c0000 [virtual] [disabled] [size=128K]
Capabilities: [60] Power Management version 3
Capabilities: [68] MSI: Enable+ Count=1/1 Maskable- 64bit+
Capabilities: [78] Express Legacy Endpoint, MSI 00
Capabilities: [100] Virtual Channel
Capabilities: [250] Latency Tolerance Reporting
Capabilities: [258] L1 PM Substates
Capabilities: [128] Power Budgeting <?>
Capabilities: [420] Advanced Error Reporting
Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024 <?>
Capabilities: [900] Secondary PCI Express <?>
Kernel driver in use: nvidia
Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia
Understanding the IDs: The format [10de:1c03] shows vendor:device. 10de = NVIDIA, 1c03 = GTX 1060 6GB. These IDs are used in driver configuration files and kernel modules. Look them up at https://pci-ids.ucw.cz/
Example 7: PCI Tree View
Display the hierarchical PCI bus topology to understand device relationships.
$ lspci -t
-[0000:00]-+-00.0
+-01.0-[01]--+-00.0
| \-00.1
+-14.0
+-16.0
+-17.0
+-1c.0-[02]----00.0
+-1f.0
+-1f.2
+-1f.3
\-1f.4
$ lspci -tv
-[0000:00]-+-00.0 Intel Corporation 8th Gen Core Processor Host Bridge/DRAM Registers
+-01.0-[01]--+-00.0 NVIDIA Corporation GP106 [GeForce GTX 1060 6GB]
| \-00.1 NVIDIA Corporation GP106 High Definition Audio Controller
+-14.0 Intel Corporation 200 Series/Z370 Chipset Family USB 3.0 xHCI Controller
+-16.0 Intel Corporation 200 Series PCH CSME HECI #1
+-17.0 Intel Corporation 200 Series PCH SATA controller [AHCI mode]
+-1c.0-[02]----00.0 Intel Corporation I219-V Gigabit Network Connection
+-1f.0 Intel Corporation Z370 Chipset LPC/eSPI Controller
+-1f.2 Intel Corporation 200 Series/Z370 Chipset Family Power Management Controller
+-1f.3 Intel Corporation 200 Series PCH HD Audio
\-1f.4 Intel Corporation 200 Series/Z370 Chipset Family SMBus Controller
Reading the Tree: Root complex (00.0) has bridges at 01.0 and 1c.0. The graphics card (01:00.0) and its audio (01:00.1) are both on the bridge at 01.0. The network card (02:00.0) is on the bridge at 1c.0.
Synopsis
lsusb [OPTIONS]
Description
The lsusb command displays information about USB buses and the devices connected to them. It reads data from /sys/bus/usb/devices and matches vendor/product IDs against the USB ID database. Useful for identifying USB devices, checking USB versions (1.1, 2.0, 3.0, 3.1), and troubleshooting peripherals.
Common lsusb Options
| Option |
Description |
| -v, --verbose |
Show detailed information about devices |
| -t |
Show USB device tree |
| -s [[bus]:][devnum] |
Show only devices on specific bus/device number |
| -d vendor:[product] |
Show only devices with specified vendor/product ID |
| -D device |
Examine device file instead of bus |
lsusb Examples
Example 8: List All USB Devices
Quick overview of all USB devices currently connected.
$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 003: ID 8087:0a2b Intel Corp. Bluetooth wireless interface
Bus 001 Device 005: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 006: ID 1b1c:1b3f Corsair Gaming K70 RGB Keyboard
Bus 001 Device 007: ID 046d:c083 Logitech, Inc. G403 Prodigy Gaming Mouse
Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Format Breakdown:
- Bus 001 = USB 2.0 bus, Bus 002 = USB 3.0 bus
- Device 001 = always the root hub (controller itself)
- ID 046d:c52b = vendor:product (046d = Logitech)
- Hub devices (05e3:0608) show where you have USB hubs in the chain
Example 9: USB Device Tree
Display USB topology showing hubs, ports, and device speeds.
$ lsusb -t
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 10000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/16p, 480M
|__ Port 5: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 5, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 6, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 1: Dev 6, If 1, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 3: Dev 7, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 3: Dev 7, If 1, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 8: Dev 3, If 0, Class=Wireless, Driver=btusb, 12M
|__ Port 8: Dev 3, If 1, Class=Wireless, Driver=btusb, 12M
|__ Port 14: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 14: Dev 4, If 1, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 14: Dev 4, If 2, Class=Human Interface Device, Driver=usbhid, 12M
Speed Indicators:
- 10000M = USB 3.1 Gen 2 (10 Gbps)
- 5000M = USB 3.0 (5 Gbps)
- 480M = USB 2.0 (480 Mbps)
- 12M = USB 1.1 Full Speed (12 Mbps)
- 1.5M = USB 1.0 Low Speed (1.5 Mbps)
Example 10: Detailed USB Device Information
Get complete descriptor information for a specific USB device.
$ lsusb -v -s 001:007
Bus 001 Device 007: ID 046d:c083 Logitech, Inc. G403 Prodigy Gaming Mouse
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x046d Logitech, Inc.
idProduct 0xc083 G403 Prodigy Gaming Mouse
bcdDevice 2.07
iManufacturer 1 Logitech
iProduct 2 G403 Prodigy Gaming Mouse
iSerial 3 0A7A387D3536
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0054
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 4 RQR20.07_B0018
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 300mA
Interface Descriptor:
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 2 Mouse
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.11
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 85
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 1
Device Status: 0x0000
(Bus Powered)
Troubleshooting with Verbose Output:
- MaxPower 300mA - Device draws 300mA; if your hub can't provide it, device may fail
- bcdUSB 2.00 - USB 2.0 device, won't benefit from USB 3.0 port speed
- iSerial - Unique serial number, useful for udev rules to identify specific devices
- Interface Class 3 - HID (Human Interface Device), handled by usbhid driver
Complete Hardware Inventory Workflow
Documenting a New System
When documenting a new server or workstation for your infrastructure inventory, use all three commands in sequence:
Step 1: Capture CPU Information
lscpu > hardware_inventory_$(hostname)_$(date +%Y%m%d).txt
lscpu --extended >> hardware_inventory_$(hostname)_$(date +%Y%m%d).txt
This documents processor architecture, core count, virtualization support, and cache topology.
Step 2: Document PCI Devices
echo "=== PCI Devices ===" >> hardware_inventory_$(hostname)_$(date +%Y%m%d).txt
lspci -nn >> hardware_inventory_$(hostname)_$(date +%Y%m%d).txt
echo "=== PCI Device Drivers ===" >> hardware_inventory_$(hostname)_$(date +%Y%m%d).txt
lspci -k >> hardware_inventory_$(hostname)_$(date +%Y%m%d).txt
Captures network cards, storage controllers, graphics, and the drivers handling them.
Step 3: List USB Devices
echo "=== USB Devices ===" >> hardware_inventory_$(hostname)_$(date +%Y%m%d).txt
lsusb >> hardware_inventory_$(hostname)_$(date +%Y%m%d).txt
echo "=== USB Topology ===" >> hardware_inventory_$(hostname)_$(date +%Y%m%d).txt
lsusb -t >> hardware_inventory_$(hostname)_$(date +%Y%m%d).txt
Documents USB peripherals and their connection topology.
Step 4: Create Summary Report
#!/bin/bash
# Complete hardware inventory script
INVENTORY_FILE="inventory_$(hostname)_$(date +%Y%m%d).txt"
echo "Hardware Inventory for $(hostname)" > $INVENTORY_FILE
echo "Generated: $(date)" >> $INVENTORY_FILE
echo "======================================" >> $INVENTORY_FILE
echo "" >> $INVENTORY_FILE
echo "CPU INFORMATION" >> $INVENTORY_FILE
echo "---------------" >> $INVENTORY_FILE
lscpu >> $INVENTORY_FILE
echo "" >> $INVENTORY_FILE
echo "PCI DEVICES" >> $INVENTORY_FILE
echo "-----------" >> $INVENTORY_FILE
lspci -nn >> $INVENTORY_FILE
echo "" >> $INVENTORY_FILE
echo "PCI KERNEL DRIVERS" >> $INVENTORY_FILE
echo "------------------" >> $INVENTORY_FILE
lspci -k >> $INVENTORY_FILE
echo "" >> $INVENTORY_FILE
echo "USB DEVICES" >> $INVENTORY_FILE
echo "-----------" >> $INVENTORY_FILE
lsusb >> $INVENTORY_FILE
echo "" >> $INVENTORY_FILE
echo "USB TOPOLOGY" >> $INVENTORY_FILE
echo "------------" >> $INVENTORY_FILE
lsusb -t >> $INVENTORY_FILE
echo "Inventory saved to: $INVENTORY_FILE"
Common Troubleshooting Scenarios
Scenario 1: Missing Network Card
# Check if hardware is detected
$ lspci | grep -i network
02:00.0 Ethernet controller: Intel Corporation I219-V Gigabit Network Connection
# Check if driver is loaded
$ lspci -k -s 02:00.0
02:00.0 Ethernet controller: Intel Corporation I219-V Gigabit Network Connection
Kernel driver in use: e1000e
Kernel modules: e1000e
# If no driver, check if module is available
$ modinfo e1000e
# Load the module if needed
$ sudo modprobe e1000e
Analysis: PCI device detected = hardware is fine. Driver loaded = software is configured. If device appears in lspci but not in ip link, check dmesg for errors.
Scenario 2: USB Device Not Recognized
# Check if device appears at all
$ lsusb
Bus 001 Device 008: ID 0781:5583 SanDisk Corp. Ultra Fit
# Check USB topology and speed
$ lsusb -t | grep -A2 "Dev 8"
|__ Port 4: Dev 8, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
# Get detailed device info
$ lsusb -v -s 001:008 | grep -A10 "Device Descriptor"
Analysis: Device appears in lsusb = hardware detected. Check driver binding, power issues (check MaxPower in verbose output), or cable/port problems if device doesn't function.
Scenario 3: Virtualization Not Available
# Check CPU virtualization support
$ lscpu | grep -i virtual
Virtualization: VT-x
# Or check for specific flags
$ lscpu | grep -E "vmx|svm"
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities
Analysis: vmx flag = Intel VT-x present, svm flag = AMD-V present. If missing, virtualization may be disabled in BIOS/UEFI settings.
Practical Scripts and One-Liners
Find All Network Devices
$ lspci | grep -i 'network\|ethernet'
02:00.0 Ethernet controller: Intel Corporation I219-V Gigabit Network Connection
Count Physical CPUs vs Logical CPUs
# Physical CPUs (sockets)
$ lscpu | grep "Socket(s):"
Socket(s): 1
# Cores per socket
$ lscpu | grep "Core(s) per socket:"
Core(s) per socket: 8
# Threads per core (hyperthreading)
$ lscpu | grep "Thread(s) per core:"
Thread(s) per core: 1
# Total logical CPUs
$ lscpu | grep "^CPU(s):"
CPU(s): 8
Find Graphics Card Model
$ lspci | grep -i vga
01:00.0 VGA compatible controller: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB]
# Get detailed GPU info
$ lspci -v -s 01:00.0
Check USB Device Power Requirements
$ lsusb -v | grep -E "Bus|MaxPower"
Bus 001 Device 007: ID 046d:c083 Logitech, Inc. G403 Prodigy Gaming Mouse
MaxPower 300mA
Bus 001 Device 006: ID 1b1c:1b3f Corsair Gaming K70 RGB Keyboard
MaxPower 500mA
Generate Hardware Report for Ticket
#!/bin/bash
# Quick hardware summary for helpdesk tickets
echo "System: $(hostname)"
echo "Date: $(date)"
echo ""
echo "CPU: $(lscpu | grep "Model name" | cut -d: -f2 | xargs)"
echo "Cores: $(lscpu | grep "^CPU(s):" | awk '{print $2}')"
echo ""
echo "Network Cards:"
lspci | grep -i "network\|ethernet"
echo ""
echo "Graphics:"
lspci | grep -i vga
echo ""
echo "USB Devices:"
lsusb | grep -v "root hub"
Related Commands and Tools
Important Files and Directories
| Path |
Description |
| /proc/cpuinfo |
Raw CPU information (lscpu reads this) |
| /sys/bus/pci/devices/ |
PCI device information in sysfs |
| /sys/bus/usb/devices/ |
USB device information in sysfs |
| /usr/share/hwdata/pci.ids |
PCI vendor/device ID database |
| /usr/share/hwdata/usb.ids |
USB vendor/product ID database |
| /proc/bus/usb/devices |
USB device tree (older systems) |
When to Update Hardware Databases
The PCI and USB ID databases are updated regularly as manufacturers release new hardware. If you see "Unknown device" for recent hardware, update the databases:
# Update PCI ID database
$ sudo update-pciids
# Update USB ID database (if available on your distro)
$ sudo update-usbids
# Or manually download latest
$ sudo wget https://pci-ids.ucw.cz/v2.2/pci.ids -O /usr/share/hwdata/pci.ids
$ sudo wget http://www.linux-usb.org/usb.ids -O /usr/share/hwdata/usb.ids
Quick Reference Summary
# CPU Information
lscpu # Human-readable CPU info
lscpu --extended # Per-CPU details with cache
lscpu --parse=CPU,CORE,SOCKET # Script-friendly output
# PCI Devices
lspci # List all PCI devices
lspci -k # Show kernel drivers
lspci -nn # Include vendor:device IDs
lspci -v -s 01:00.0 # Detailed info for specific device
lspci -t # PCI tree topology
# USB Devices
lsusb # List USB devices
lsusb -t # USB tree with speeds
lsusb -v # Verbose device descriptors
lsusb -s 001:007 # Specific device details
# Combined Hardware Inventory
lscpu > hw_inventory.txt
lspci -nn >> hw_inventory.txt
lsusb >> hw_inventory.txt