The lspci command in Linux: system PCI devices

Introduction

In Linux systems, the PCI bus (Peripheral Component Interconnect) is the main way through which the stem plate communicates with devices such as network cards, graphics, storage and other peripherals. Knowing which devices are connected and how the kernel recognizes them is essential to manage hardware, debugging problems and optimizing performance.

What is lspci?

lspci is a command line utility that belongs to the packagepciutils. Its function is to list all PCI devices present in the system, showing information such as the supplier identifier, device identifier, class, in-use controller and assigned resources.

Installation

In most distributions,pciutilsIt's already installed. If it is not, it can be installed with the corresponding package manager:

  • Debian / Ubuntu:sudo apt-get install pciutils
  • Fedora:sudo dnf install pciutils
  • Arch Linux:sudo pacman -S pciutils

Basic use

Runlspciwithout arguments shows a summary list:

lspci

Example output:

00: 00.0 Host bridge: Intel Corporation Xeon E3-1200 v6 / 7th Gen Core Processor Host Bridge / DRAM Registers (rev 02)

Each line has the formatbus:device.functionfollowed by the description of the device.

Most useful options

  • -vor--verbose: shows detailed information, including the assigned memory ranges and IRQ.
  • -vv: further increases the level of detail, showing device capabilities and link configurations.
  • -k: indicates the kernel controller that is handling each device and the available modules.
  • -nn: shows the supplier and device identifiers in numerical format (see: dev) in addition to the descriptive name.
  • -t: presents the hierarchy of PCI buses in the form of a tree, useful for visualizing relationships between bridges and devices.
  • -s <bus>:[<device>][.[<function>]]: filters the output to a specific slot.

Practical examples

List all devices in detail

lspci -v

See the driver used by the graphics card

lspci -k | grep -A 2 -i VGA

Show only network devices

lspci -nn | grep -i net

Get the bus tree

lspci -t

Interpretation of the exit

The output oflspcicontains several fields:

  • Slot: indicates the physical position on the bus (bus: devI.function).
  • Class: describes the type of device (e.g., «Ethernet controller» or «VGA compatible controller»).
  • Supplier and device: the four-character ID that identifies the manufacturer and the specific model.
  • In-use controller: thanks to the option-k, it shows which kernel module is managing the device.
  • Resources: memory ranges, I / O ports and IRQ lines assigned.

Understanding these data helps to identify whether a device is using the right controller, whether there are resource conflicts or if it is necessary to load an additional module.

Common problem solution

  • Device does not appear: may be due to the fact that the hardware is not properly seated, a lack of energy or the kernel does not support that device. Check the physical connection and trylspci -nnto see if the ID shows up.
  • Wrong controller:: yeslspci -kshows a generic module or «none», you may need to install the owner driver or update the kernel.
  • IRQ conflict: in old systems, several devices can share the same IRQ line, causing instability. Uselspci -vto review the IRQ and consider reallocating them to the BIOS or by kernel parameters.
  • Low performance: verify that the device is operating in its maximum bandwidth (e.g., PCIe x16 vs x1) using the link information it provideslspci -vv.

Conclusion

The commandlspciis an essential tool for any Linux system manager who needs to inspect and manage the PCI hardware. With its various options, it allows from a quick view of the installed devices to a deep analysis of drivers, resources and bus topology. Dominating its use facilitates problem diagnosis, update planning and system performance optimization.

This work is under aCreative Commons License Attribution 4.0 International for Francesc Roig francesc @ vivaldi.net.

EnglishenEnglishEnglish