Introduction to lspci Command in Linux
This guide delves into the Linux lspci
command, a vital utility for system administrators and anyone interested in understanding their hardware. We'll explore how lspci
unveils information about Peripheral Component Interconnect (PCI) buses and devices connected to your Linux system. This tutorial covers the purpose of the lspci
command, its diverse range of options, and practical techniques for identifying PCI devices. This knowledge empowers you to troubleshoot hardware problems effectively, understand your system's components, and gain a comprehensive view of your hardware setup. Perfect for any systemadmin seeking to enhance their Linux expertise.
We'll begin by executing the fundamental lspci
command to reveal the PCI devices detected by your system, showcasing their names, vendor details, and other key attributes. Subsequently, we'll examine the different flags and options associated with lspci
to extract even more granular data about these PCI devices.
Understanding the Core Functionality of lspci
In this section, we'll focus on the primary role of the lspci
command within Linux environments. The lspci
command serves as a robust tool for displaying specifics about the Peripheral Component Interconnect (PCI) buses and the devices that connect through them to your system.
lspci
delivers detailed information about the PCI devices present, including their device names, manufacturers, and other pertinent facts. This is invaluable when diagnosing hardware issues, cataloging system components, and generally grasping your hardware landscape. A key skill for any systemadmin.
To begin, let's execute a basic lspci
command:
sudo lspci
Example output:
00:00.0 Host bridge: Intel Corporation 8th Gen Core Processor Host Bridge/DRAM Registers (rev 07)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (rev 07)
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (rev 02)
00:14.0 USB controller: Intel Corporation Cannon Lake PCH USB 3.1 xHCI Host Controller (rev 10)
00:14.2 RAM memory: Intel Corporation Cannon Lake PCH Shared SRAM (rev 10)
00:16.0 Communication controller: Intel Corporation Cannon Lake PCH HECI Controller (rev 10)
00:17.0 SATA controller: Intel Corporation Cannon Lake PCH SATA AHCI Controller (rev 10)
00:1b.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #21 (rev f0)
00:1c.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #1 (rev f0)
00:1d.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #13 (rev f0)
The output above showcases the PCI devices recognized, spanning from the host bridge to PCI bridges, a VGA controller, and a USB controller. Each line signifies a PCI device, giving its device ID, the vendor, and other relevant information.
The lspci
command's utility expands with various options, facilitating the display of more focused PCI device information, which we'll discuss next.
Exploring Advanced Options and Flags of lspci
Here, we'll dive into the array of options and flags that lspci
offers, giving you pinpoint accuracy when gathering data about your PCI devices.
First, examine the full set of available options using the manual page:
man lspci
This reveals the manual for lspci
, detailing each option and its use.
Common lspci
options include:
-v
: Provides verbose output, enhancing the information displayed for each PCI device.-vv
: Delivers very verbose output, enriching data with technical specifics.-s <slot>
: Limits the display to the PCI device residing in the specified slot.-d <vendor>:<device>
: Shows data solely for devices matching the given vendor and/or device ID.-n
: Presents device and vendor IDs numerically, instead of resolved names.-nn
: Displays IDs numerically while also performing name lookups.
Let's demonstrate some options:
sudo lspci -v
Example output:
00:00.0 Host bridge: Intel Corporation 8th Gen Core Processor Host Bridge/DRAM Registers (rev 07)
Subsystem: Lenovo 8th Gen Core Processor Host Bridge/DRAM Registers
Flags: bus master, fast devsel, latency 0
Capabilities: <access denied>
Kernel driver in use: skl_uncore
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (rev 07)
Flags: bus master, fast devsel, latency 0, IRQ 122
Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
I/O behind bridge: 0000c000-0000cfff
Memory behind bridge: f6000000-f60fffff
Prefetchable memory behind bridge: 00000000e0000000-00000000e01fffff
Capabilities: <access denied>
Kernel driver in use: pcieport
The -v
option supplies a richer dataset per PCI device, adding the device name, vendor specifics, capabilities, and the current kernel driver.
Combine options for even narrower results:
sudo lspci -nn
This displays numeric PCI device and vendor IDs alongside name translations.
sudo lspci -s 00:02.0 -v
This provides expanded details about the device at slot 00:02.0
.
Practice using different options to see how precisely you can target and extract PCI device information.
Identifying and Interpreting PCI Devices on Your System
This final segment teaches you how to decipher the information presented by lspci
for PCI device identification.
Start with a basic lspci
run:
sudo lspci
Example output:
00:00.0 Host bridge: Intel Corporation 8th Gen Core Processor Host Bridge/DRAM Registers (rev 07)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (rev 07)
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (rev 02)
00:14.0 USB controller: Intel Corporation Cannon Lake PCH USB 3.1 xHCI Host Controller (rev 10)
00:14.2 RAM memory: Intel Corporation Cannon Lake PCH Shared SRAM (rev 10)
00:16.0 Communication controller: Intel Corporation Cannon Lake PCH HECI Controller (rev 10)
00:17.0 SATA controller: Intel Corporation Cannon Lake PCH SATA AHCI Controller (rev 10)
00:1b.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #21 (rev f0)
00:1c.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #1 (rev f0)
00:1d.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #13 (rev f0)
The output displays PCI devices present, like the host bridge, PCI bridges, VGA controller, and USB controller. Every line represents a PCI device and includes its device ID, vendor, and other data.
Use lspci -v
for comprehensive details on a specific device:
sudo lspci -v -s 00:02.0
This retrieves thorough information on the device in slot 00:02.0
, which, in this case, is the VGA controller.
Employ lspci -nn
to reveal numeric IDs, aiding specific device identification:
sudo lspci -nn
Example output:
00:00.0 Host bridge [0600]: Intel Corporation 8th Gen Core Processor Host Bridge/DRAM Registers [8086:3e30] (rev 07)
00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller [8086:1901] (rev 07)
00:02.0 VGA compatible controller [0300]: Intel Corporation UHD Graphics 630 [8086:3e9b] (rev 02)
00:14.0 USB controller [0c03]: Intel Corporation Cannon Lake PCH USB 3.1 xHCI Host Controller [8086:a36d] (rev 10)
00:14.2 RAM memory [0500]: Intel Corporation Cannon Lake PCH Shared SRAM [8086:a36f] (rev 10)
00:16.0 Communication controller [0780]: Intel Corporation Cannon Lake PCH HECI Controller [8086:a360] (rev 10)
00:17.0 SATA controller [0106]: Intel Corporation Cannon Lake PCH SATA AHCI Controller [8086:a353] (rev 10)
00:1b.0 PCI bridge [0604]: Intel Corporation Cannon Lake PCH PCI Express Root Port #21 [8086:a344] (rev f0)
00:1c.0 PCI bridge [0604]: Intel Corporation Cannon Lake PCH PCI Express Root Port #1 [8086:a338] (rev f0)
00:1d.0 PCI bridge [0604]: Intel Corporation Cannon Lake PCH PCI Express Root Port #13 [8086:a33c] (rev f0)
The numeric IDs support precise device lookup and specification retrieval.
Mastering lspci
empowers you with essential hardware insights valuable for troubleshooting, inventory, and systems understanding.
Conclusion
This tutorial explored the functionality and application of the lspci
command in Linux. This command is critical for any systemadmin as it unveils the details of PCI architecture and all its connected devices. We have shown how the basic lspci
command can give valuable details, such as the device names, vendor info and other important information. These details are important for identifying system components, or troubleshooting and debugging hardware related issues. We also learned how to use the different lspci
options and flags to fine tune the amount of data displayed.