lspci

hardware informationLinux
The lspci command is one of the most frequently used commands in Linux/Unix-like operating systems. lspci List all PCI devices

Quick Reference

Command Name:

lspci

Category:

hardware information

Platform:

Linux

Basic Usage:

lspci [options] [arguments]

Common Use Cases

    Syntax

    lspci [options]

    Options

    Option Description
    -v Be verbose (display detailed information)
    -vv Be very verbose (display even more details)
    -vvv Be extremely verbose (display everything the driver knows)
    -k Show kernel drivers handling each device
    -n Show numeric IDs (PCI vendor and device codes)
    -nn Show both textual and numeric IDs
    -t Show a tree-like diagram of the PCI bus hierarchy
    -x Show hexadecimal dump of the standard configuration space
    -xxx Show hexadecimal dump of the whole configuration space
    -b Show bus-centric view (addresses and IRQs as seen by the bus)
    -D Show PCI domain numbers
    -s [[domain]:][bus]:[device].[function] Show only devices in specified domain/bus/device/function
    -d [vendor]:[device] Show only devices with specified vendor/device ID
    -i file Use specified ID database instead of /usr/share/hwdata/pci.ids
    -p file Look up kernel modules in specified map file
    -m Dump PCI device data in machine-readable form
    -mm Dump PCI device data in machine-readable form with a single value per line

    Examples

    How to Use These Examples

    The examples below show common ways to use the lspci command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.

    # Basic Examples Basic
    lspci
    Display a quick listing of all PCI devices.
    lspci -v
    Show detailed information about all PCI devices.
    # Advanced Examples Advanced
    lspci -vv Show very verbose output with even more details. lspci -k Show kernel drivers handling each device. lspci -nn Show both textual and numeric PCI IDs (vendor and device codes). lspci -t Show the PCI device tree. lspci -s 03:00.0 Show detailed information for device at bus 03, device 00, function 0. lspci -d 8086: Show all Intel devices (vendor ID 8086). lspci -vvv -s 01:00.0 > gpu_info.txt Export very detailed information about a specific device to a file. lspci -vmm Show machine-readable output format.

    Try It Yourself

    Practice makes perfect! The best way to learn is by trying these examples on your own system with real files.

    Understanding Syntax

    Pay attention to the syntax coloring: commands, options, and file paths are highlighted differently.

    Notes

    The 'lspci' command is a utility for displaying information about PCI buses in the system and devices connected to them. It's part of the pciutils package and provides detailed information about hardware components that are connected to the PCI (Peripheral Component Interconnect) bus, including graphics cards, network adapters, storage controllers, and other expansion cards. Key features of the lspci command: 1. Hardware Discovery: lspci identifies all PCI and PCI Express devices in the system, providing a comprehensive inventory of installed hardware components. 2. Detailed Device Information: The command can display various levels of detail about each device, from basic identification to extensive technical specifications and capabilities. 3. Driver Information: With the -k option, lspci shows which kernel modules (drivers) are handling each device, which is invaluable for troubleshooting hardware support issues. 4. Device Identification: lspci can show both human-readable device descriptions and the numeric PCI IDs (vendor and device codes) that uniquely identify hardware components. 5. Bus Topology Visualization: The -t option displays the hierarchical structure of PCI buses, bridges, and devices, helping to understand the physical organization of the system's hardware. 6. Configuration Space Access: Advanced options allow viewing the raw configuration space data of PCI devices, which can be useful for low-level debugging. 7. Filtering Capabilities: lspci can filter output to show only specific devices based on their location (bus/device/function) or vendor/device IDs. Common use cases for lspci include: - Identifying hardware components in a system - Checking if hardware is properly detected by the operating system - Troubleshooting device driver issues - Verifying hardware compatibility - Gathering system information for documentation or support - Finding vendor and device IDs to search for appropriate drivers - Diagnosing PCI bus-related issues lspci relies on a database of PCI IDs (usually located at /usr/share/hwdata/pci.ids or similar) to translate numeric hardware identifiers into human-readable names. This database is regularly updated to include new hardware components. The command is especially useful for system administrators, hardware technicians, and Linux users who need to gather information about their system's hardware configuration. It's often one of the first tools used when troubleshooting hardware-related problems on Linux systems.

    Related Commands

    These commands are frequently used alongside lspci or serve similar purposes:

    Use Cases

    Learn By Doing

    The best way to learn Linux commands is by practicing. Try out these examples in your terminal to build muscle memory and understand how the lspci command works in different scenarios.

    $ lspci
    View All Commands