To see all PCI devices in Linux, the most common, powerful, and universally available command-line utility is lspci
. This command provides a comprehensive list of all PCI (Peripheral Component Interconnect) devices connected to your system, along with detailed information about each one.
Understanding lspci
The lspci
command is a utility designed to query and display information about all PCI buses and devices in a human-readable format. It is an essential tool for system administrators, developers, and users who need to diagnose hardware issues, verify device installations, or gather system information.
One of the greatest advantages of lspci
is that it comes pre-installed on virtually all Linux distributions. This means you typically won't need to worry about installing it. However, in rare or minimal installations, if you find lspci
is not available, you can install the pciutils
package, which contains the lspci
utility.
Basic Usage
To get a simple list of all PCI devices, open your terminal and type:
lspci
This command will output a list showing each PCI device, its bus ID, and a brief description of the device.
Example Output (simplified):
00:00.0 Host bridge: Intel Corporation Skylake Host Bridge/DRAM Registers (rev 07)
00:01.0 PCI bridge: Intel Corporation Skylake PCIe Controller (x16) (rev 07)
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
00:14.0 USB controller: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller (rev 31)
00:16.0 Communication controller: Intel Corporation 100 Series/C230 Series Chipset Family Management Engine Interface (rev 31)
00:17.0 SATA controller: Intel Corporation Q170/Q150/B150/H170/H110/Z170/X99 Chipset SATA Controller [AHCI Mode] (rev 31)
00:1c.0 PCI bridge: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #1 (rev f1)
00:1c.4 PCI bridge: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #5 (rev f1)
00:1f.0 ISA bridge: Intel Corporation H110 Chipset LPC Controller (rev 31)
00:1f.2 Memory controller: Intel Corporation 100 Series/C230 Series Chipset Family Power Management Controller (rev 31)
00:1f.3 Audio device: Intel Corporation 100 Series/C230 Series Chipset Family HD Audio Controller (rev 31)
00:1f.4 SMBus: Intel Corporation 100 Series/C230 Series Chipset Family SMBus (rev 31)
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
Advanced lspci
Options for Detailed Information
lspci
offers several options to filter output or display more verbose information, which can be incredibly useful for troubleshooting and in-depth analysis.
Option | Description | Example Command |
---|---|---|
-v |
Display verbose information about devices. | lspci -v |
-vv |
Display very verbose information, including all PCI capabilities. | lspci -vv |
-k |
Show kernel modules (drivers) handling each device. | lspci -k |
-s [slot] |
Show information only about a specific device. Use format BB:DD.F (Bus:Device.Function). |
lspci -s 00:1f.3 |
-d [vend:dev] |
Show only devices with a specific vendor and device ID. | lspci -d 8086:a170 |
-t |
Show a tree-like diagram of PCI devices. | lspci -t |
-n |
Show vendor and device codes as numbers instead of names. | lspci -n |
-m |
Produce output in a machine-readable format. | lspci -m |
Practical Examples:
-
View Verbose Information for All Devices:
To see more details like IRQ, memory addresses, and more, use the-v
flag:lspci -v
-
Identify Device Drivers (Kernel Modules):
If you want to know which kernel module is loaded for a specific PCI device, the-k
flag is invaluable:lspci -k
This output will include a "Kernel driver in use" line for each device where applicable.
-
Inspect a Specific Device:
If you've identified a device (e.g.,00:1f.3
for your audio controller) and want to focus on its details, use the-s
flag followed by the device's bus ID:lspci -s 00:1f.3 -vv
This will provide very verbose information specifically for that audio device.
-
Visualize the PCI Bus Topology:
The-t
option provides a helpful tree-like structure, illustrating how PCI devices are connected through various bridges:lspci -t
Alternative Method: /sys/bus/pci/devices
While lspci
is the go-to command for a human-readable summary, Linux also exposes PCI device information directly through the /sys
filesystem, which is part of sysfs. Each detected PCI device has a corresponding directory under /sys/bus/pci/devices/
.
You can explore these directories to find raw device information. For example, to list all device directories:
ls /sys/bus/pci/devices/
Inside each device directory (e.g., /sys/bus/pci/devices/0000:00:1f.3/
), you'll find files containing various attributes like vendor
, device
, subsystem_vendor
, subsystem_device
, uevent
, and more. This method is often used by scripts or applications that need programmatic access to PCI device details.
By utilizing lspci
and its versatile options, you can effectively list and inspect all PCI devices on your Linux system, gaining valuable insights into your hardware configuration.