Linux lspci Command
What is the lspci Command
lspciIt is a utility command in Linux systems used to list information about all PCI devices. PCI (Peripheral Component Interconnect) is a computer bus standard used to connect the motherboard with various hardware devices.
With this command,lspcisystem administrators and developers can:
- View all PCI devices installed in the system
- Obtain detailed device information, including vendor ID, device ID, etc.
- Diagnose hardware compatibility issues
- Check whether drivers are loaded correctly
Basic Syntax
lspciThe basic syntax format of the command is as follows:
lspci [选项]
If no options are provided,lspciit will display a brief list of information for all PCI devices in the system.
Common Options
Display detailed information
Example
lspci -vv # Display more detailed information (very verbose)
lspci -vvv # Display the most detailed information (very very verbose)
Query a specific device
Example
For example:
Example
Other common options
Example
lspci -nn # Display both numeric IDs and device names
lspci -k # Display kernel driver module information
lspci -t # Display the device hierarchy as a tree diagram
lspci -mm # Output in machine-readable format
lspci -D # Display the full domain name (including domain number)
Interpreting the Output
A typicallspcioutput is as follows:
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01) 00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01) 00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08) 00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01) 00:07.2 USB controller: Intel Corporation 82371AB/EB/MB PIIX4 USB (rev 01) 00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08) 00:0f.0 VGA compatible controller: VMware SVGA II Adapter 00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01) 00:11.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01) 00:12.0 Multimedia audio controller: Ensoniq ES1371/ES1373 / Creative Labs CT2518 (rev 02)
Output format description:
- First part:
00:00.0is the device address, formatted asBus:Device.Function - Second part: device type, such as "Host bridge", "VGA compatible controller", etc.
- Third part: device vendor and specific model
Practical Application Examples
Example 1: View basic information of all PCI devices
Example
Example 2: View detailed information of the graphics card
Example
Example 3: View USB controller and its driver information
Example
Example 4: Display PCI devices in a tree structure
Example
Example output:
-[0000:00]-+-00.0
+-01.0
+-07.0
+-07.1
+-07.2
+-07.3
+-0f.0
+-10.0
+-11.0
\-12.0
Common Problem Solutions
1. Command not found
If the system promptslspci: command not found, it means you need to install thepciutilspackage:
Example
sudo apt-get install pciutils
# CentOS/RHEL
sudo yum install pciutils
2. Insufficient permissions
When a normal user executeslspci, they may not be able to obtain complete information. You can usesudo:
Example
3. Device recognition issues
If some devices are not recognized, you can try updating the PCI ID database:
Example
Advanced Tips
1. Combine grep to filter specific devices
Example
lspci | grep -i audio # Find sound card
2. Export device information to a file
Example
3. View the complete configuration space of a device
Example
Summary
lspciis an important tool for diagnosing and viewing PCI device information in Linux systems. After reading this article, you should be able to:
- Understand
lspcithe basic usage and common options of the command - Interpret
lspcithe output information of - Use
lspcito solve common hardware recognition problems - Master some advanced usage tips
For system administrators and developers, being proficient in using thelspcicommand can help quickly locate hardware-related issues, and it is one of the important skills for Linux system maintenance.