Skip to main content

Command Palette

Search for a command to run...

Cheat Sheet #day31 - lspci

Published
2 min readView as Markdown
Cheat Sheet #day31 - lspci

lspci Cheatsheet

Basic Usage

  • Display all PCI devices:

      lspci
    

Display Options

  • Verbose output (more detailed information):

      lspci -v
    
  • Very verbose output (even more details):

      lspci -vv
    
  • Maximum verbosity (most detailed output):

      lspci -vvv
    
  • Show detailed output for a specific device (replace <device> with the specific device ID):

      lspci -v -s <device>
    
  • Show only the specified device:

      lspci -s <device>
    

Information Types

  • Show numerical IDs (useful for scripting):

      lspci -n
    
  • Show both textual and numerical IDs:

      lspci -nn
    
  • Display information in a tree-like format:

      lspci -t
    
  • Show kernel drivers handling each device:

      lspci -k
    
  • Show hexadecimal dump of the standard config space:

      lspci -x
    
  • Show detailed hexadecimal dump of the config space:

      lspci -xxx
    
  • Show capabilities (if available):

      lspci -vv -s <device>
    

Filtering and Sorting

  • Filter output by vendor or device name (case insensitive):

      lspci | grep -i <vendor_or_device_name>
    
  • Filter and show detailed output for specific devices:

      lspci -v | grep -i -A 20 <vendor_or_device_name>
    

PCI Resources

  • Show the resource configuration:

      lspci -v -m
    
  • Show only resource information:

      lspci -vvv | grep -E '^[0-9a-f]+:|Region|Memory'
    

Example Commands

  • List all NVIDIA devices:

      lspci | grep -i nvidia
    
  • Show detailed information for a specific device (e.g., the first Ethernet controller):

      lspci -v | grep -i ethernet -A 10
    
  • List devices along with their kernel drivers:

      lspci -k
    

Saving and Parsing Output

  • Save the output to a file:

      lspci -v > lspci_output.txt
    
  • Read and parse saved output:

      cat lspci_output.txt
    

This cheatsheet provides a quick reference to the most commonly used lspci commands and options, helping you to efficiently manage and troubleshoot PCI devices on your system.