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

last updated in Categories , , ,

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. Let us see how to use various command to view PCI devices info on CentOS 7 and RedHat Enterprise Linux 7 (RHEL 7).

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
Fig.01: Fix bash: lspci: command not found on CentOS 7 server

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

Simply install the pciutils package on CentOS/RHEL 7 server:
# yum install pciutils
Sample outputs:

Fig.02: CentOS install pciutils package
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
Fig.03: Download new version of the PCI ID list

How do I list all PCI devices?

Type the following command to view PCI devices info on CentOS 7 or RHEL 7:
# lspci
# lspci [options]
# lspci
# lspci | more
# lspci -t -v

Sample outputs:

Fig.04: lspci in action - displaying PCI devices info on CentOS 7 and RedHat Enterprise Linux 7
Fig.04: lspci in action

How to see wifi PCI devices info on CentOS 7 / RHEL 7

Run the lspci command and filter out information using the grep command or egrep command:
lspci | egrep -i 'wifi|wireless'
04:00.0 Network controller: Intel Corporation Wireless 7260 (rev bb)

Guess what the following command does?
# lspci | egrep -i 'eth|network|wifi|wireless'
Want to find out wifi or Ethernet driver name on a CentOS 7 or RedHat Enterprise Linux 7? Try:
lspci -s 04:00.0 -v
Sample outputs:

04:00.0 Network controller: Intel Corporation Wireless 7260 (rev bb)
	Subsystem: Intel Corporation Dual Band Wireless-AC 7260
	Flags: bus master, fast devsel, latency 0, IRQ 57
	Memory at c1500000 (64-bit, non-prefetchable) [size=8K]
	Capabilities: [c8] Power Management version 3
	Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Capabilities: [40] Express Endpoint, MSI 00
	Capabilities: [100] Advanced Error Reporting
	Capabilities: [140] Device Serial Number 7c-5c-f8-ff-ff-8e-33-a2
	Capabilities: [14c] Latency Tolerance Reporting
	Capabilities: [154] Vendor Specific Information: ID=cafe Rev=1 Len=014 <?>
	Kernel driver in use: iwlwifi
	Kernel modules: iwlwifi

See “Linux Find Wireless Driver Chipset Information” for more info.

More info

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

Conclusion

You just learned how to use lspci and other command line utilties to find out information about your PCI devices on a CentOS 7 or RHEL 7. The PCI Utilities are a collection of Linux utilities for inspecting and manipulating configuration of PCI devices. I suggest you read the following info:

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Start the discussion at www.nixcraft.com

Historical Comment Archive

2 comment

    Have a question? Post it on our forum!