Cheat Sheet #day31 - lspci

lspci Cheatsheet
Basic Usage
Display all PCI devices:
lspci
Display Options
Verbose output (more detailed information):
lspci -vVery verbose output (even more details):
lspci -vvMaximum verbosity (most detailed output):
lspci -vvvShow 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 -nShow both textual and numerical IDs:
lspci -nnDisplay information in a tree-like format:
lspci -tShow kernel drivers handling each device:
lspci -kShow hexadecimal dump of the standard config space:
lspci -xShow detailed hexadecimal dump of the config space:
lspci -xxxShow 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 -mShow only resource information:
lspci -vvv | grep -E '^[0-9a-f]+:|Region|Memory'
Example Commands
List all NVIDIA devices:
lspci | grep -i nvidiaShow detailed information for a specific device (e.g., the first Ethernet controller):
lspci -v | grep -i ethernet -A 10List devices along with their kernel drivers:
lspci -k
Saving and Parsing Output
Save the output to a file:
lspci -v > lspci_output.txtRead 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.




