How to see PCI devices info on CentOS 7 and RedHat Enterprise Linux 7

Datetime:2016-08-22 23:41:45          Topic: Centos           Share

I wanted to see PCI devices information on my CentOS/RHEL 7 box. But, I’m getting an error that read as, “-bash: lspci: command not found”. How do I solve this problem and see PCI devices information on CentOS/RHEL 7?

The lspci command is used to display detailed information about all PCI buses and devices in the server or desktop or laptop powered by Linux operating system. It is based on a common portable library libpci which offers access to the PCI configuration space on a variety of operating systems.

Why do I get “-bash: lspci: command not found” error?

The following error indicates that the lspci command not installed on your system when you install CentOS server or it was removed:

Fig.01: Fix bash: lspci: command not found on CentOS 7 server

The fix

Simply install the pciutils package on CentOS/RHEL 7 server:

# yum install pciutils

Sample outputs:

Fig.02: CentOS install pciutils package

Update the PCI ID list

To download new version of the PCI ID list, enter:

# update-pciids

Sample outputs:

Fig.03: Download new version of the PCI ID list

How do I list all PCI devices?

Type the following command:

# lspci
 # lspci [options]
 # lspci
 # lspci -t -v
 

Sample outputs:

Fig.04: lspci in action

Here is a list of all options from lspci man page:

Basic display modes:
-mm		Produce machine-readable output (single -m for an obsolete format)
-t		Show bus tree
 
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>]			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
Share this tutorial on:




About List