lspci
List PCI devices
TLDR
Show a brief list of devices
Display additional information (Note: the -v flag can be repeated to increase verbosity)
Display drivers and modules handling each device
Show a specific device
Dump info in a readable form
Show PCI vendor and device codes alongside its name
SYNOPSIS
lspci [options]
PARAMETERS
-v
Be verbose - show detailed information about all devices. Multiple -v options increase the verbosity level (e.g., -vv, -vvv).
-k
Show kernel drivers handling each device and kernel modules capable of handling it.
-n
Show PCI vendor and device codes as numeric IDs instead of looking them up in the PCI ID list.
-nn
Show both numeric IDs and their human-readable names.
-s [domain:]bus:device.function
Show only devices in the specified slot. For example, -s 00:01.0.
-d [vendor]:[device]
Show only devices with the specified vendor and device IDs. For example, -d 10de: for all NVIDIA devices or -d :0001 for devices with device ID 0001.
-t
Show a tree-like diagram of PCI devices, illustrating their hierarchy.
-x
Show a hex dump of the first 64 bytes of the device's PCI configuration space. Use -xx to dump the full configuration space.
-m
Use machine readable output. Options like -mm and -Q provide even more structured output suitable for parsing by scripts.
-D
Always show PCI domain numbers. (PCI domains group multiple PCI buses, common in large systems with more than 256 buses).
-i file
Use the specified file as an alternative PCI ID list instead of the default /usr/share/hwdata/pci.ids or similar.
DESCRIPTION
lspci is a powerful utility for displaying comprehensive information about all PCI buses and devices present in the system. It enumerates hardware connected via the Peripheral Component Interconnect (PCI) bus, including modern PCI Express (PCIe) devices. The command reveals critical details such as vendor and device IDs, subsystem IDs, revision numbers, device classes (e.g., network controller, display controller, storage controller), and various capabilities (e.g., PCIe, power management, MSI-X). This information is invaluable for system administrators, developers, and users for tasks like hardware identification, troubleshooting, driver installation, and verifying system configurations. By default, lspci provides a concise summary, but it offers numerous options to control the verbosity, including showing kernel driver information, hexadecimal dumps of configuration registers, and machine-readable formats. It primarily queries the /sys filesystem on modern Linux systems to gather its data.
CAVEATS
Accessing full device information, especially configuration registers, often requires root privileges. Without them, lspci might show incomplete details or fail to list certain devices. The accuracy of human-readable names depends on the pci.ids database, which should be kept up-to-date (e.g., using update-pciids). In virtualized environments, lspci might present virtualized devices rather than the underlying physical hardware.
PCI ID DATABASE
lspci relies on a database, typically located at /usr/share/hwdata/pci.ids or /usr/share/pci.ids, to translate numeric vendor and device IDs into human-readable names. This file contains a comprehensive list of known PCI devices, vendors, and subsystems. It needs periodic updates to recognize new hardware.
DATA SOURCES
On Linux, lspci primarily gathers information from the /sys/bus/pci/devices filesystem, which is populated by the kernel's PCI subsystem. For older kernels or specific configurations, it might fall back to reading from /proc/bus/pci or directly accessing I/O ports for configuration space, although the /sys interface is preferred and more robust.
PCIE SUPPORT
lspci fully supports PCI Express (PCIe) devices, including their specific capabilities (e.g., Advanced Error Reporting - AER, Active State Power Management - ASPM, Resizable BAR) and the extended configuration space that PCIe devices utilize.
HISTORY
The lspci command is a core component of the pciutils package, a suite of utilities designed for inspecting and manipulating PCI devices. Its development began to provide Linux users with a standardized way to query PCI hardware, which is fundamental for system configuration and troubleshooting. As PCI technology evolved from its initial standard to PCI-X and then to PCI Express, lspci has been consistently updated to support new capabilities, configuration register layouts, and bus structures, ensuring its relevance for modern PCI-based hardware. Its primary data source shifted from direct hardware access or the /proc filesystem to the more structured /sys filesystem on contemporary Linux kernels, enhancing stability and integration.
SEE ALSO
lsusb(8), lshw(1), setpci(8), update-pciids(8)