lspci 命令详解

| 选择喜欢的代码风格  

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

lspci 命令安装:


-bash/zsh: lspci: command not found

# Windows (WSL2)
sudo apt-get update sudo apt-get install pciutils

# Debian
apt-get install pciutils

# Ubuntu
apt-get install pciutils

# Alpine
apk add pciutils

# Arch Linux
pacman -S pciutils

# Kali Linux
apt-get install pciutils

# CentOS
yum install pciutils

# Fedora
dnf install pciutils

# Raspbian
apt-get install pciutils

# Dockerfile
dockerfile.run/lspci

# Docker
docker run cmd.cat/lspci lspci

lspci 命令补充说明:


lspci 命令用于在 Linux 系统上查看硬件信息的命令,提供了不同层次和类型的信息。当使用 lspci 命令时,您可以得到关于系统上 PCI 总线设备的详细信息。

要使用 lspci,需要有 linux 2.1.82 或以上版本,支持 /proc/bus/pci 接口的内核。

lspci 命令语法:


lspci [<switches>]


Basic display modes:
-mm             Produce machine-readable output (single -m for an obsolete format)
-t              Show bus tree

lspci 命令选项:


Display options:
-v              Be verbose (-vv for very verbose)
-k              Show kernel drivers handling each device
-x              Show hex-dump of the standard part of the config space
-xxx            Show hex-dump of the whole config space (dangerous; root only)
-xxxx           Show hex-dump of the 4096-byte extended config space (root only)
-b              Bus-centric view (addresses and IRQ's as seen by the bus)
-D              Always show domain numbers

Resolving of device ID's to names:
-n              Show numeric ID's
-nn             Show both textual and numeric ID's (names & numbers)
-q              Query the PCI ID database for unknown ID's via DNS
-qq             As above, but re-query locally cached entries
-Q              Query the PCI ID database for all ID's via DNS

Selection of devices:
-s [[[[<domain>]:]<bus>]:][<slot>][.[<func>]]   Show only devices in selected slots
-d [<vendor>]:[<device>][:<class>]              Show only devices with specified ID's

Other options:
-i <file>       Use specified ID database instead of /usr/share/hwdata/pci.ids
-p <file>       Look up kernel modules in a given file instead of default modules.pcimap
-M              Enable `bus mapping' mode (dangerous; root only)

PCI access options:
-A <method>     Use the specified PCI access method (see `-A help' for a list)
-O <par>=<val>  Set PCI access parameter (see `-O help' for a list)
-G              Enable PCI access debugging
-H <mode>       Use direct hardware access (<mode> = 1 or 2)
-F <file>       Read PCI configuration dump from a given file

lspci 命令实例:


lspci 显示设备的简要列表:

$ lspci

00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Communication controller: Red Hat, Inc Virtio console
00:04.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:05.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:06.0 Ethernet controller: Red Hat, Inc Virtio network device
00:07.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon
00:1f.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge

lspci 显示附加信息:

$ lspci -v

00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
        Subsystem: Red Hat, Inc Qemu virtual machine
        Flags: fast devsel

00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
        Subsystem: Red Hat, Inc Qemu virtual machine
        Flags: medium devsel

00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] (prog-if 80 [Master])
        Subsystem: Red Hat, Inc Qemu virtual machine
        Flags: bus master, medium devsel, latency 0
        [virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
        [virtual] Memory at 000003f0 (type 3, non-prefetchable)
        [virtual] Memory at 00000170 (32-bit, non-prefetchable) [size=8]
        [virtual] Memory at 00000370 (type 3, non-prefetchable)
        I/O ports at d060 [size=16]
        Kernel driver in use: ata_piix
        Kernel modules: ata_piix, pata_acpi, ata_generic

00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01) (prog-if 00 [UHCI])
        Subsystem: Red Hat, Inc QEMU Virtual Machine
        Flags: bus master, fast devsel, latency 0, IRQ 11
        I/O ports at d000 [size=32]
        Kernel driver in use: uhci_hcd

00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
        Subsystem: Red Hat, Inc Qemu virtual machine
        Flags: medium devsel, IRQ 9
        Kernel driver in use: piix4_smbus
        Kernel modules: i2c_piix4

00:02.0 VGA compatible controller: Cirrus Logic GD 5446 (prog-if 00 [VGA controller])
        Subsystem: Red Hat, Inc QEMU Virtual Machine
        Flags: fast devsel
        Memory at fc000000 (32-bit, prefetchable) [size=32M]
        Memory at fea10000 (32-bit, non-prefetchable) [size=4K]
        Expansion ROM at fea00000 [disabled] [size=64K]
        Kernel driver in use: cirrus
        Kernel modules: cirrus

00:03.0 Communication controller: Red Hat, Inc Virtio console
        Subsystem: Red Hat, Inc Device 0003
        Physical Slot: 3
        Flags: bus master, fast devsel, latency 0, IRQ 10
        I/O ports at d020 [size=32]
        Memory at fea11000 (32-bit, non-prefetchable) [size=4K]
        Capabilities: [40] MSI-X: Enable+ Count=2 Masked-
        Kernel driver in use: virtio-pci
        Kernel modules: virtio_pci

00:04.0 SCSI storage controller: Red Hat, Inc Virtio block device
        Subsystem: Red Hat, Inc Device 0002
        Physical Slot: 4
        Flags: bus master, fast devsel, latency 0
        Memory at fe200000 (64-bit, prefetchable) [size=4K]
        Memory at fe201000 (64-bit, prefetchable) [size=4K]
        Capabilities: [40] MSI-X: Enable+ Count=3 Masked-
        Kernel driver in use: virtio-pci
        Kernel modules: virtio_pci

00:05.0 SCSI storage controller: Red Hat, Inc Virtio block device
        Subsystem: Red Hat, Inc Device 0002
        Physical Slot: 5
        Flags: bus master, fast devsel, latency 0
        Memory at fe202000 (64-bit, prefetchable) [size=4K]
        Memory at fe203000 (64-bit, prefetchable) [size=4K]
        Capabilities: [40] MSI-X: Enable+ Count=3 Masked-
        Kernel driver in use: virtio-pci
        Kernel modules: virtio_pci

00:06.0 Ethernet controller: Red Hat, Inc Virtio network device
        Subsystem: Red Hat, Inc Device 0001
        Physical Slot: 6
        Flags: bus master, fast devsel, latency 0
        Memory at fe204000 (64-bit, prefetchable) [size=4K]
        Memory at fe205000 (64-bit, prefetchable) [size=4K]
        Capabilities: [40] MSI-X: Enable+ Count=18 Masked-
        Kernel driver in use: virtio-pci
        Kernel modules: virtio_pci

00:07.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon
        Subsystem: Red Hat, Inc Device 0005
        Physical Slot: 7
        Flags: bus master, fast devsel, latency 0, IRQ 10
        I/O ports at d040 [size=32]
        Kernel driver in use: virtio-pci
        Kernel modules: virtio_pci

00:1f.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge (prog-if 00 [Normal decode])
        Physical Slot: 31
        Flags: 66MHz, fast devsel, IRQ 11
        Memory at fea12000 (64-bit, non-prefetchable) [size=256]
        Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
        I/O behind bridge: 0000c000-0000cfff
        Memory behind bridge: fe800000-fe9fffff
        Prefetchable memory behind bridge: 00000000fe000000-00000000fe1fffff
        Capabilities: [4c] MSI: Enable- Count=1/1 Maskable+ 64bit+
        Capabilities: [48] Slot ID: 0 slots, First+, chassis 01
        Capabilities: [40] Hot-plug capable
        Kernel modules: shpchp

lspci 处理每个设备的显示驱动程序和模块:

lspci -k

lspci 显示特定设备:

lspci -s 00:18.3

lspci 以可读形式转储信息:

lspci -vm

lspci 命令扩展阅读:




lspci 命令评论

共收录到 512Linux 命令