Linux Command Reference ยท System Information
Linux lspci and lsusb commands
Reference for lspci and lsusb: list PCI and USB devices, show vendor IDs, drivers and the device tree with -v, -k, -nn and -t, and filter the output in scripts.
lspci lists the devices on the PCI bus (graphics cards, network adapters, storage controllers, and the chipset itself); lsusb lists devices on USB buses (keyboards, drives, webcams, hubs). Both translate numeric vendor and device IDs into names using a database that ships with pciutils and usbutils.
They read device information from /sys, so they work as a normal user. Containers and the sandbox on this site have no hardware view, so the commands are read-only examples here; the TryIts parse saved sample output the same way you would parse real output.
lspci [-nn] [-k] [-v] [-t] lsusb [-v] [-t] [-d VENDOR:PRODUCT]
Try it
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Syntax
lspci [OPTIONS] lsusb [OPTIONS]
| Option | Description |
|---|---|
lspci -k |
Also show the kernel driver in use and the modules able to handle the device. |
lspci -nn |
Show numeric [vendor:device] IDs next to the names. |
lspci -v, -vv |
More detail: memory ranges, IRQ, capabilities (-vv or root may be needed for all). |
lspci -t |
Draw the bus topology as a tree. |
lspci -s SLOT |
Only one device, for example -s 00:02.0. |
lsusb -t |
Tree of buses, hubs, devices and their drivers and speeds. |
lsusb -d VID:PID |
Only devices matching a vendor and product ID. |
lsusb -v |
Full descriptors (often needs root for every device). |
Returns: 0 on success; non-zero if the bus cannot be read (for example lspci: Cannot find any working access method) or when lsusb -d finds nothing.
Usage notes
- IDs are the stable key. Names come from a database that may be out of date. Use
[vendor:device]pairs (-nn) in scripts and bug reports; runupdate-pciidsto refresh names. - Drivers:
lspci -kis the first thing to run when "the Wi-Fi doesn't work". A device withKernel driver in use:missing has no active driver. Seelsmodandmodprobe. - Virtual machines show emulated or paravirtual devices (virtio, e1000). Containers see the host's
/sysonly if allowed; many show nothing. - Slot format is
bus:device.function, optionally with a domain prefix (0000:00:02.0). The same string names the folder under/sys/bus/pci/devices/. - No PCI on some systems. Small ARM boards and some VMs have no PCI bus at all;
lspciis then empty or fails, whilelsusborlsblkstill work. - Not hot-plug events: these tools take a snapshot. Watch changes with
udevadm monitoror by readingdmesg. - Related views: disks appear in
lsblk, CPUs inlscpu, the whole machine inlshwordmidecode(both need root).
Related
lsmodandmodprobe,lsblk,lscpu,dmesg- Lessons: Boot and kernel, Disks and logs