Linux lspci Command Tutorial with Examples – POFTUT

Linux lspci Command Tutorial with Examples


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.

Install For Ubuntu, Debian, Kali, Mint

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

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

Install For Fedora, CentOS, Fedora

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

$ sudo yum install pciutils
Install For Fedora, CentOS, Fedora
Install For Fedora, CentOS, Fedora

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.

$ lspci
List PCI Devices
List PCI Devices

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.

$ 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.

$ 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.

$ 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.

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.

$ 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.

$ lspci -n -vmm
Print Device Vendor Codes
Print Device Vendor Codes

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.

$ lspci -k
Show Kernel Module Of The PCI Devices
Show Kernel Module Of The PCI Devices

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

  • Device Name
  • Subsystem
  • Kernel driver
  • Kernel module
LEARN MORE  WPS (Wi-Fi Protected Setup) Tutorial With Examples

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.

$ lspci -tv
List PCI Devices In Tree Format
List PCI Devices In Tree Format

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

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.

$ lspci -vv

Leave a Comment