lspci
List PCI devices and hardware attached to the system
By CMD Script Team · 4 min read · Last updated
lspci [OPTIONS]Options
| Flag | Description |
|---|---|
-v | Verbose output, showing additional details for each device |
-vv | Very verbose output, showing all available details, including vendor-specific capabilities |
-t | Show a tree diagram of PCI devices and how they connect through buses/bridges |
-k | Show the kernel driver currently bound to each device, plus available kernel modules |
-nn | Show both numeric vendor/device IDs and their resolved human-readable names |
-s | Show details for only the device at the given PCI bus/slot address, e.g. -s 00:02.0 |
Distribution compatibility
- Ubuntu
- Debian
- Fedora
- Arch
- macOS (not available; no direct PCI enumeration tool, use system_profiler SPPCIDataType)
What it does
lspci lists all PCI (Peripheral Component Interconnect) devices detected on the
system — things like the GPU, network controllers, USB host controllers, SATA
controllers, and other hardware connected via the PCI/PCIe bus. It reads this
information from the kernel's /sys/bus/pci interface and resolves vendor/device IDs
into human-readable names using the pci.ids database. It requires the pciutils
package on most distributions.
Beginner examples
lspci— list every PCI device with a short descriptionlspci -v— list devices with additional verbose detaillspci -tv— show devices arranged as a tree, reflecting bus/bridge topologylspci | grep -i vga— find the graphics device specifically
lspci
Advanced examples
- Show the tree topology with verbose device names:
lspci -tv - Check which kernel driver is bound to the network card:
lspci -k | grep -A3 -i ethernet - Get maximum detail (including vendor-specific capabilities) for deep debugging:
lspci -vv - Inspect a specific device by its bus address (from a plain
lspcilisting):lspci -s 01:00.0 -vv - Show both numeric IDs and resolved names, useful when filing driver bug reports:
lspci -nn
lspci -k | grep -A3 -i ethernet
Common mistakes
- Running
lspciexpecting to see USB peripherals (keyboards, mice, flash drives) — those attach via the USB bus and show up inlsusb, notlspci; PCI only covers devices on the PCI/PCIe bus itself (including the USB controller hardware). - Expecting
lspcito work identically on macOS — there's no built-in PCI enumeration tool;system_profiler SPPCIDataTypeis the closest macOS equivalent. - Seeing unresolved numeric vendor/device IDs and assuming the hardware is
unrecognized/broken, when it may just mean the local
pci.idsdatabase is outdated (fixable withsudo update-pciids). - Forgetting that some detailed output (like
-vvregister dumps) requires root privileges to fully populate; running as a normal user can silently omit some fields.
Tips
- Use
lspci -kfirst when a piece of hardware "isn't working" — it immediately shows whether any kernel driver is bound at all. lspci -tvis the fastest way to understand PCI bus topology, especially on servers with multiple PCIe slots, risers, or passthrough devices in a VM.- Keep the
pciutilspackage's ID database current withsudo update-pciidsso device names resolve correctly, especially on newer hardware.
Best practices
- When troubleshooting hardware detection issues, run
lspci -kbefore jumping to kernel module or driver reinstallation — confirm the device is even visible on the bus first. - In bug reports or support tickets, include
lspci -nnoutput so both the human-readable name and the exact numeric vendor:device ID are captured unambiguously. - On virtualized/cloud instances, use
lspcito confirm which virtual devices (e.g., virtio-net, virtio-blk) are actually exposed to the guest before debugging performance issues.
Try it yourself
A simulated shell with a sample home directory — experiment freely, nothing leaves your browser. Type help to list supported commands.
Real-world use cases
- Diagnosing why a GPU, network card, or storage controller isn't being recognized by the kernel.
- Confirming which driver is bound to a device before troubleshooting a hardware-specific bug.
- Auditing installed hardware on a new or unfamiliar server, especially bare-metal machines.
- Verifying that a passthrough PCI device is correctly visible inside a virtual machine.
Common interview questions
- How would you check which kernel driver is bound to a specific piece of PCI
hardware?
lspci -k, which lists theKernel driver in use:line for each device. - What's the difference between
lspciandlsusb?lspcienumerates devices on the PCI/PCIe bus (GPUs, network cards, storage controllers);lsusbenumerates devices on the USB bus (keyboards, mice, flash drives, USB hubs) — they cover different hardware buses. - Why might
lspcishow a device with only numeric IDs instead of a name? The localpci.idsdatabase used to resolve names may be outdated or missing an entry for very new hardware; runningsudo update-pciidsrefreshes it.
Frequently Asked Questions
How do I see which kernel driver is handling a specific PCI device?
Use lspci -k, which lists each device along with the Kernel driver in use: line, and often a Kernel modules: line showing which modules could be loaded for it — useful for diagnosing missing or misbehaving drivers.
What does the -vv flag add over -v?
-v shows a moderate amount of extra detail (memory ranges, capabilities); -vv adds even more, including vendor-specific and extended capability register details, which is mostly useful for deep hardware debugging rather than everyday use.
Why does lspci show generic vendor/device numbers instead of friendly names?
lspci resolves names using a local copy of the PCI ID database (pci.ids); if that database is outdated or a device is very new, it may only show numeric IDs. Running sudo update-pciids refreshes the local database from the canonical source.
Cheat sheet
Download a quick-reference cheat sheet for lspci.