Read PCI Hardware Safely with lspci
lspci finds every PCI device on the bus and the driver claiming it, all without touching hardware. That makes it the natural first step for a graphics card that will not initialise, a NIC that vanished after a kernel update, or a SATA controller nobody remembers installing. The examples use lspci 3.10.0 from pciutils 3.10.0-2build1.
The route
Jump straight to the step you need, or tick off Done means at the end.
Allow about fifteen minutes. You need a shell and the pciutils package. The normal inspection commands are read-only and do not need elevated privileges. Some configuration-space dumps need root and can upset badly behaved hardware, so they are kept behind a clear warning at the end.
1. Confirm the installed command
Check which binary your shell will run, then record its version, so you are not explaining output from a different installation later:
$ command -v lspci
/usr/bin/lspci
$ lspci --version
lspci version 3.10.0
$ dpkg-query -W -f='${Package} ${Version}\n' pciutils
pciutils 1:3.10.0-2build1
--version is meant to be used on its own. If your package manager or distribution reports a different version, expect names and detailed fields to vary slightly from what is shown here.
Checkpoint
You know the executable and version. Continue with ordinary user privileges.
2. Get the inventory first
Run lspci without options for the short inventory:
$ lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 05)
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
00:14.0 USB controller: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller (rev 31)
00:17.0 SATA controller: Intel Corporation Q170/Q150/B150/H170/H110/Z170/CM236 Chipset SATA Controller [AHCI Mode] (rev 31)
Your list will be different. The value at the start of each line is the PCI address: domain, bus, device and function, written out when needed. On a machine with only domain 0, lspci normally hides the domain. Use -D when an address must be unambiguous:
$ lspci -D | head -n 3
0000:00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 05)
0000:00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
0000:00:14.0 USB controller: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller (rev 31)
The address is not a device file, and it is not a command to change hardware. It is an identifier you feed into the selection options below.
3. Add numeric IDs when names are not enough
Names come from the local PCI ID list, and that list can be incomplete or stale. Add -nn to show class, vendor and device numbers alongside the names:
$ lspci -nn | head -n 3
00:00.0 Host bridge [0600]: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers [8086:591f] (rev 05)
00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 630 [8086:5912] (rev 04)
00:14.0 USB controller [0c03]: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller [8086:a12f] (rev 31)
- Use -nn when you want names and numeric IDs side by side.
- Use -n instead when you want numeric IDs without the name lookup.
- Keep the vendor:device pair, such as
8086:5912, for bug reports or comparing two hosts.
Do not use -q casually in automation: it may query the central PCI ID database over DNS and cache results in ~/.pciids-cache. Prefer the local result for repeatable scripts, and investigate a missing name separately.
4. See the hardware relationship and driver
Use the tree view when a flat list hides which bridges connect which devices:
$ lspci -t
-[0000:00]-+-00.0
+-02.0
+-14.0
+-17.0
\-1f.6
The exact branches depend on the host. For the driver and capable modules, use -k:
$ lspci -k | sed -n '1,12p'
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 05)
Subsystem: Fujitsu Technology Solutions Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers
Kernel driver in use: skl_uncore
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
Subsystem: Fujitsu Technology Solutions HD Graphics 630
Kernel modules: i915
"Kernel driver in use" is the driver handling that device right now. "Kernel modules" lists modules that claim they can handle it, which is not the same as one being loaded or selected. A blank driver line can be a useful finding on its own, not proof the device is broken.
Checkpoint
You can identify a device, its numeric IDs, its place in the bus tree, and its current driver without changing system state.
5. Narrow a query to one device
Use -s with the address from the inventory. Components are hexadecimal. This example selects the VGA device at bus 0, device 2, function 0:
$ lspci -s 00:02.0 -nnk
00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 630 [8086:5912] (rev 04)
Subsystem: Fujitsu Technology Solutions HD Graphics 630
Kernel modules: i915
-s 0:selects bus 0.-s 00:02selects all functions of that device.-s 00:02.0selects one function.
Do not confuse a decimal-looking address with decimal input: PCI address components are hexadecimal throughout. You can also filter by ID with -d. This selects every device from vendor 8086:
$ lspci -d 8086: -nn
00:00.0 Host bridge [0600]: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers [8086:591f] (rev 05)
00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 630 [8086:5912] (rev 04)
The wildcard after the colon means any device ID from that vendor. Verify the address or ID from your own inventory before you build a monitoring rule around it.
6. Produce output for a script
Human-oriented output can change shape between lspci versions. For a simple, shell-oriented record per device, use -m:
$ lspci -m | head -n 2
00:00.0 "Host bridge" "Intel Corporation" "Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers" -r05 -p00 "Fujitsu Technology Solutions" "Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers"
00:02.0 "VGA compatible controller" "Intel Corporation" "HD Graphics 630" -r04 -p00 "Fujitsu Technology Solutions" "HD Graphics 630"
For fielded records, use -mm. It separates records with blank lines and uses tags such as Slot, Class, Vendor, Device, Driver and Module. Parsers must ignore tags they do not recognise, because later versions can add more. Add -n if your parser wants numeric IDs rather than names. Do not parse the ordinary default display: you accept version-specific breakage the moment you do.
7. Treat configuration dumps as a separate risk
-x reads the standard configuration-space area. The full-configuration-space form reads the whole area and is restricted to root on many systems; some devices can crash when the command reads parts of it. The extended form reads the 4096-byte area where supported.
Warning
These options are still reads on paper, but they can have real hardware consequences. Do not run them on a production host just to collect more detail. If a driver report specifically asks for a dump, confirm the exact command, take a maintenance window, and use the least invasive level that answers the question:
$ sudo lspci -s 00:02.0 -x
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
00: 86 80 12 59 07 00 00 00 04 00 00 03 00 00 00 00
The bytes and line count vary by device. There is no general undo for a read, so recovery means stopping the moment a device behaves abnormally, recording the command and output, and following the hardware or vendor recovery procedure. Ordinary lspci, -nn, -t, -k and -mm do not alter PCI configuration at all.
Done means
- You confirmed the installed lspci and pciutils version.
- You can list devices and make domain numbers explicit when needed.
- You can identify numeric IDs, bus relationships and the active kernel driver.
- You can select one PCI address or vendor ID without guessing its syntax.
- You use
-mor-mmfor scripts instead of parsing display prose. - You know that configuration dumps are privileged, hardware-sensitive reads and have a reason before using them.