linux命令lspci_Linux lspci命令教程和示例

linux命令lspci

linux命令lspci

Linux provides lspci command in order to list PCI bus and devices information. This command will provide brief or detailed information about currently connected PCI devices like GPU, USB Card etc.

Linux提供lspci命令以列出PCI总线和设备信息。 该命令将提供有关当前连接的PCI设备(如GPU,USB卡等)的简要或详细信息。

为Ubuntu,Debian,Kali,Mint安装 (Install For Ubuntu, Debian, Kali, Mint)

We can install lspci tool with the following command to the deb based distributions.

我们可以使用以下命令将lspci工具安装到基于deb的发行版中。

$ sudo apt install pciutils
Install For Ubuntu, Debian, Kali, Mint
Install For Ubuntu, Debian, Kali, Mint
为Ubuntu,Debian,Kali,Mint安装

为Fedora,CentOS,Fedora安装(Install For Fedora, CentOS, Fedora)

In yum or dnf based distributions we can use the following command which will install the package named pciutils.

在基于yumdnf的发行版中,我们可以使用以下命令来安装名为pciutils的软件包。

$ sudo yum install pciutils
Install For Fedora, CentOS, Fedora
Install For Fedora, CentOS, Fedora
为Fedora,CentOS,Fedora安装

列出PCI设备(List PCI Devices)

We will start with the simplest form where we will do not provide any option to this command. This will print PCI Address or slot information with the device type and vendor information.

我们将从最简单的形式开始,在该形式中,我们将不为该命令提供任何选项。 这将打印PCI地址或插槽信息以及设备类型和供应商信息。

$ lspci
List PCI Devices
List PCI Devices
列出PCI设备

显示指定的插槽或地址设备(Show Specified Slot or Address Devices)

Most of the computers have a few PCI interfaces. This may list a lot of information which will jam the output. Or we may be interested in the specific PCI slot of address. In this example, we will print information about PCI slot number 00:10.0 which is SCSI device controller.

大多数计算机都有一些PCI接口。 这可能会列出很多会阻塞输出的信息。 或者我们可能对地址的特定PCI插槽感兴趣。 在此示例中,我们将打印有关PCI插槽号00:10.0即SCSI设备控制器)的信息。

$ lspci -s 00:10.0
Show Specified Slot or Address Devices
Show Specified Slot or Address Devices
显示指定的插槽或地址设备

打印机器可读格式(Print Machine-Readable Format)

The default printing format is human-readable format. This means PCI address or slot, vendor and product information is printed in a space delimited format. Machine-readable format is a double quote separated format which can be parsed easily.

默认的打印格式是人类可读的格式。 这意味着PCI地址或插槽,供应商和产品信息以空格分隔的格式打印。 机器可读格式是一种双引号分隔的格式,可以轻松解析。

$ lspci -m
Print Machine-Readable Format
Print Machine-Readable Format
打印机器可读格式

详细输出(Verbose Output)

PCI bus provides a lot of information about the PCI connection and the devices. By default, this information is not printed completely. We can print detailed information about this PCI connection and device with the verbose -v option like below.

PCI总线提供了大量有关PCI连接和设备的信息。 默认情况下,此信息未完全打印。 我们可以使用下面的详细-v选项打印有关此PCI连接和设备的详细信息。

$ lspci -v
Verbose Output
Verbose Output
详细输出

We can see that for every PCI device information like Subsystem, Flag, Memory Location or Address, Kernel Driver In Use, Kernel Modules, I/O ports etc.

我们可以看到每个PCI设备的信息,例如子系统,标志,内存位置或地址,正在使用的内核驱动程序,内核模块,I / O端口等。

以标签:值格式打印信息 (Print Information In Tag:Value Format)

We can also print PCI Slot and Devices information in tag:value format. This will make the information readable like JSON format. We will use -vmms option like below.

我们还可以使用tag:value格式打印PCI插槽和设备信息。 这将使信息像JSON格式一样可读。 我们将使用-vmms选项,如下所示。

$ lspci -vmm
Print Information In Tag:Value Format
Print Information In Tag:Value Format
以标签:值格式打印信息

打印设备供应商代码(Print Device Vendor Codes)

Every computer hardware manufacturer has its own vendor and device code or ID. We can print device vendor, class, svendor,sdevice ID with the -n option like below.

每个计算机硬件制造商都有自己的供应商和设备代码或ID。 我们可以使用-n选项打印设备供应商,类,供应商,sdevice ID,如下所示。

$ lspci -n -vmm
Print Device Vendor Codes
Print Device Vendor Codes
打印设备供应商代码

显示PCI设备的内核模块(Show Kernel Module Of The PCI Devices)

As very PCI device have its kernel module and driver to be used by the Linux operating system. We can list all kernel and drivers with the -k option like below.

由于PCI设备具有其内核模块和驱动程序供Linux操作系统使用。 我们可以使用-k选项列出所有内核和驱动程序,如下所示。

$ lspci -k
Show Kernel Module Of The PCI Devices
Show Kernel Module Of The PCI Devices
显示PCI设备的内核模块

We can see that the following information is provided by -k.

我们可以看到-k提供了以下信息。

  • Device Name

    设备名称
  • Subsystem

    子系统
  • Kernel driver

    内核驱动
  • Kernel module

    内核模块
LEARN MORE  What Is Unix?
了解更多什么是Unix?

以树格式列出PCI设备 (List PCI Devices In Tree Format)

Up to now, we have listed PCI Devices in a line by line or regular format. We can also list the output of the lspci in a tree format with a hierarchical manner. We will use -t option like below.

到目前为止,我们已经按行或常规格式列出了PCI设备。 我们还可以通过树的方式以分层方式列出lspci的输出。 我们将使用-t选项,如下所示。

$ lspci -tv
List PCI Devices In Tree Format
List PCI Devices In Tree Format
以树格式列出PCI设备

We can see that some devices are listed under VMware USB controller.

我们可以看到某些设备在VMware USB控制器下列出。

非常详细模式所有详细信息 (Very Verbose Mode All Details)

We have already printed detailed or verbose information about the PCI slots. We will use multiple -v option -vv or -vvv . More v means more verbose or detail.

我们已经打印了有关PCI插槽的详细信息。 我们将使用多个-v选项-vv-vvvv越大,意味着越详细或细节。

$ lspci -vv

翻译自: https://www.poftut.com/linux-lspci-command-tutorial-with-examples/

linux命令lspci

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值