lspci — 列出 PCI 裝置資訊

列出系統中所有 PCI 裝置(顯示卡、網卡等)及其驅動程式資訊。

語法

lspci [選項]

常用選項

選項 說明 範例
-v 詳細資訊 lspci -v
-vv 更詳細資訊(含暫存器值等) lspci -vv
-k 顯示驅動程式(kernel driver/module) lspci -k
-n 只顯示供應商和裝置 ID(數字格式) lspci -n
-nn 同時顯示名稱和數字 ID lspci -nn
-s 位址 只顯示指定匯流排位置的裝置 lspci -s 01:00.0
--update/-Q 更新 PCI ID 資料庫(需要網路) sudo lspci -Q

使用範例

範例 1:列出所有 PCI 裝置
$ lspci
00:00.0 Host bridge: Intel Corporation 8th Gen Core Processor Host Bridge/DRAM Registers
01:00.0 VGA compatible controller: NVIDIA Corporation TU116 [GeForce GTX 1660 Ti]
02:00.0 Ethernet controller: Realtek Semiconductor RTL8111/8168/8411
範例 2:查看顯示卡和網卡的驅動程式

確認對應驅動程式(Kernel driver)是否正確載入。

$ lspci -k | grep -A 3 "VGA\|Ethernet\|Network"
01:00.0 VGA compatible controller: NVIDIA ...
	Kernel driver in use: nvidia
	Kernel modules: nvidiafb, nouveau, nvidia
02:00.0 Ethernet controller: Realtek ...
	Kernel driver in use: r8169
範例 3:確認 GPU 型號(常用於部署 CUDA 環境)
$ lspci | grep -i "vga\|3d\|nvidia\|amd\|radeon"
01:00.0 VGA compatible controller: NVIDIA Corporation TU116 [GeForce GTX 1660 Ti]

常見錯誤與排錯

lspci: Cannot find any working access method.
原因
通常在虛擬機中 PCI 存取受限。
解法
嘗試 sudo lspci 或使用 lspci -A linux-sysfs。

延伸閱讀