The lspci command in Linux is a valuable tool for viewing information about PCI devices connected to your system. As a Linux system administrator, developer, or power user, having a deep understanding of lspci can help you troubleshoot hardware issues, analyze system resources, and debug driver problems. In this comprehensive guide, we‘ll cover everything you need to know to become a lspci power user.
An Introduction to PCI and PCIe
Before diving into lspci, it‘s important to understand what PCI is. PCI stands for Peripheral Component Interconnect, and is a standard for connecting hardware devices to a computer‘s motherboard. Some common examples of PCI devices are network cards, sound cards, SATA controllers, and GPUs.
PCI Express, also known as PCIe, is an updated version of PCI that offers higher maximum system bus throughput, lower I/O pin count and smaller physical footprint, while maintaining software compatibility with older PCI devices. Most modern computers use PCIe rather than the older PCI standard.
When you boot up a Linux system, the PCI host bridge performs an enumeration process to detect PCI devices and assign each a unique address. The lspci command reads this address information to display details about each device.
Getting Started with lspci
The lspci command is included in virtually all Linux distributions. To get basic usage information, run:
lspci -h
This displays available command line options for formatting the output.
To view all PCI devices detected by your system, simply run:
lspci
This prints each device on its own line, showing:
- Slot – The PCI slot address, such as 00:00.0
- Class – The general device classification, such as Network controller
- Vendor – The device vendor name, such as Intel
- Device – The device name/model, such as 82540EM Gigabit Ethernet
- Rev – The device revision number
Here‘s example output from my Ubuntu server:
00:00.0 Host bridge: Intel Corporation 82845G/GL[Brookdale-G]/GE/PE DRAM Controller/Host-Hub Interface (rev 01)
00:02.0 VGA compatible controller: Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device (rev 01)
00:1d.0 USB controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01)
00:1d.1 USB controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01)
00:1d.2 USB controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01)
00:1d.7 USB controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 81)
00:1f.0 ISA bridge: Intel Corporation 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge (rev 01)
00:1f.1 IDE interface: Intel Corporation 82801DB (ICH4) IDE Controller (rev 01)
00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 01)
01:09.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
This shows my server‘s integrated graphics, USB, SATA, networking and other core devices that connect via PCI slots to the motherboard.
Using lspci to Get Detailed Device Information
The simple lspci output gives you a quick overview of devices, but there is much more detailed information available about each one. Use the -v (verbose) and -vv (very verbose) flags to get more info:
lspci -v
lspci -vv
The -v output includes more details on each device, such its bus, capabilities flags, and more:
00:02.0 VGA compatible controller: Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device (rev 01) (prog-if 00 [VGA controller])
Subsystem: Dell 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device
Physical Slot: 2
Flags: bus master, fast devsel, latency 0
Memory at dc000000 (32-bit, non-prefetchable) [size=16M]
Memory at d8000000 (32-bit, prefetchable) [size=128M]
Capabilities: [d0] AGP version 2.0
Meanwhile, -vv appends IRQ and BIST information about each device to the output:
00:02.0 VGA compatible controller: Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device (rev 01) (prog-if 00 [VGA controller])
Subsystem: Dell 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device
Physical Slot: 2
Flags: bus master, fast devsel, latency 0
Memory at dc000000 (32-bit, non-prefetchable) [size=16M]
Memory at d8000000 (32-bit, prefetchable) [size=128M]
Capabilities: [d0] AGP version 2.0
Kernel driver in use: agpgart-intel
Kernel modules: intelfb
So for debugging hardware issues, -v or -vv output can provide helpful clues not available in the default view.
Some other useful options include:
-s [[[[domain]:]bus]:][slot][.[func]]– Show only devices in the specified domain/bus/slot or functions. This lets you isolate specific hardware.-d [vendor]:[device]– Show only devices with the specified vendor and device ID.-k– Show the kernel driver handling each device-nn– Look up and print PCI vendor and device codes
For programmers and driver developers, -xxx prints hexadecimal dumps of various PCI configuration registers:
lspci -xxx
And -n disables name resolution, showing numeric vendor/device codes instead:
00:02.0 0300: 8086:3577 (rev 01)
So in summary, lspci‘s verbose options give you fine-grained control to filter output and reveal detailed PCI information for your Linux box.
Using lspci to Troubleshoot Hardware and Drivers
Armed with lspci options for targeted PCI device introspection, you can begin troubleshooting several types of common issues:
Missing drivers – If hardware like a network card or disk controller shows up with no driver listed, a necessary kernel module is likely missing:
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)
Subsystem: ASUSTeK Computer Inc. P8B WS Motherboard
Flags: bus master, fast devsel, latency 0, IRQ 255
I/O ports at d000 [size=256]
Memory at fe2f0000 (64-bit, non-prefetchable) [size=4K]
Capabilities: <access denied>
Kernel driver in use: r8169
Here the network interface lists no driver, meaning it won‘t function properly. Installing the r8169 module would likely fix it.
Hardware conflicts – lspci helps identify conflicts, such as two devices attempting to use the same IRQs or I/O ports:
00: 02.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
Subsystem: Intel Corporation Gigabit ET Dual Port Server Adapter
Flags: bus master, fast devsel, latency 0, IRQ 16
Memory at fe200000 (32-bit, non-prefetchable) [size=128K]
I/O ports at d020 [size=32]
00:19.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
Subsystem: Intel Corporation Gigabit ET Dual Port Server Adapter
Flags: bus master, fast devsel, latency 0, IRQ 16
Memory at fe300000 (32-bit, non-prefetchable) [size=128K]
I/O ports at d040 [size=32]
Here you can see two NICs attempting to use IRQ 16. Changing these to unused IRQs would resolve the conflict.
Hardware issues – Faulty hardware that causes kernel errors will show up in logs. Use dmesg to investigate further:
lspci -knn | grep Eth -A3
02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 15)
Subsystem: ASUSTeK Computer Inc. P8B WS Motherboard [1043:8411]
Kernel driver in use: r8169
Kernel modules: r8169
dmesg | grep r8169
r8169 0000:02:00.0: can‘t disable ASPM; OS doesn‘t have ASPM control
Here we see the NIC is producing kernel errors, likely indicating a fault.
So in summary, lspci provides diagnostic info to help identify the root cause of hardware and driver issues.
Finding Vendor/Device Details with lspci
When debugging unfamiliar PCI hardware, it helps to lookup details on that component using its vendor and device ID codes.
Consider this example device:
01:00.1 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)
The vendor ID is LSI Logic / Symbios Logic and the device ID is MegaRAID SAS 2108 [Liberator].
You can manually search the web for details on those strings, but lspci makes it easier by looking up info in the PCI ID database.
Use -nn to show numeric vendor/device codes:
01:00.1 RAID bus controller [0104]: 1000:008e (rev 05)
Here the vendor code is 1000 and device is 008e.
Then pass those codes to -nns, which looks up and prints details from the PCI ID database:
lspci -nns 1000:008e
01:00.1 RAID bus controller [0104]: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] [1000:008e] (rev 05)
This prints out human-readable vendor/device names for easy lookup.
You can query any vendor/device pair this way for quick hardware research as you analyze your PCI devices.
Other lspci Features
We‘ve covered the most useful features, but lspci has a few more tricks:
-ishows PCI bridge topology and bus layout details for your mobo chipset-t/-ttoutputs device data in a friendly tree diagram-bdumps raw configuration registers spaces (for kernel devs)-xhex dumps the standard part of the device‘s PCI configuration registers-xxxdumps the whole pci config registers in hex (for kernel devs)
So while most just use lspci for a quick device list, as you can see it has powerful options for detailed hardware introspection.
Conclusion
Whether you‘re a Linux system admin, kernel developer, or IT pro, the lspci command can provide invaluable hardware analysis. It‘s a must-know tool for probing PCI bus devices, diagnosing issues, exploring configs, and gaining low-level system insights.
I encourage you to run lspci frequently – during normal operation and when trouble strikes – watching how the output changes over time and under different conditions. This builds intuition for understanding your hardware and where to look when odd issues emerge.
Mastering lspci requires learning what the various verbose flags show, practicing lookups of vendor/device details, and correlating its output with other kernel logs. With expertise, you‘ll unlock the full potential of this versatile PCI exploration tool.


