LinuxCommandLibrary

lspci

List PCI devices

TLDR

Show a brief list of devices

$ lspci
copy

Display additional info
$ lspci -v
copy

Display drivers and modules handling each device
$ lspci -k
copy

Show a specific device
$ lspci -s [00:18.3]
copy

Dump info in a readable form
$ lspci -vm
copy

SYNOPSIS

lspci [options]

PARAMETERS

-v
    Verbose mode. Show detailed information about device configuration.

-vv
    Very verbose mode. Show even more detail.

-vvv
    Extremely verbose mode. Show the most information possible.

-n
    Show numeric IDs (vendor and device).

-nn
    Show both textual and numeric IDs.

-x
    Show configuration space dump.

-xxx
    Show the raw configuration dump (including the PCI header).

-s [[bus]:][slot][.func]
    Show only devices in specified domain, bus, slot and/or function. Each component is optional.

-d [vendor]:[device]
    Show only devices with specified vendor and device ID.

-i
    Use specified ID database instead of /usr/share/hwdata/pci.ids.

-m
    Dump the device data in a machine-readable form.

-t
    Show PCI device tree.

-k
    Show kernel drivers handling each device and also available modules capable to handle it.

-D
    Always show domain number.

-P
    Access PCI devices using direct PCI access.

-version
    Show version of the lspci utility.

DESCRIPTION

The `lspci` command is a utility for displaying information about PCI buses in a system and devices connected to them. It gathers details about devices like graphics cards, network adapters, storage controllers, and other peripherals plugged into the PCI bus. It queries the PCI configuration space for each device, presenting information such as vendor ID, device ID, device class, revision ID, and resource assignments (memory regions, I/O ports, and interrupt lines). lspci is invaluable for system administrators and developers to diagnose hardware problems, identify devices, and understand the system's hardware configuration. The tool relies on accessing specific files under `/proc` and `/sys` (e.g., `/sys/bus/pci/devices/*`) which requires superuser or root privileges for complete access.
The information lspci provides allows for informed decisions regarding driver installation, resource allocation, and hardware troubleshooting. It's an essential component in understanding the hardware landscape of a Linux system.

CAVEATS

Requires root or superuser privileges to access all PCI devices information. Output interpretation may require knowledge of PCI specifications.

DEVICE CLASS CODES

The output often includes a class code representing the device's category (e.g., Ethernet controller, VGA compatible controller). Refer to PCI specifications for a detailed listing of these codes.

BUS MASTERING

The lspci output can indicate whether a device is capable of bus mastering, which is a key feature impacting performance.

HISTORY

The `lspci` command has been a staple of Linux systems for a long time, evolving alongside the PCI standard. It was created to provide a standardized way to enumerate and inspect PCI devices without needing to write custom low-level code. Over time, features were added to improve its versatility for diagnosis and information gathering.
Its usage spans a broad range of activities from simple device identification to in-depth troubleshooting of hardware configurations.

SEE ALSO

setpci(8), pcilib(7)

Copied to clipboard