Lspci

From Christoph's Personal Wiki
Jump to: navigation, search

lspci is a utility for displaying information about PCI buses in the system and devices connected to them.

Examples

Networking

You might have seen some systems using Ethernet interface names like "enp0s3" instead of the traditional "ethN" nomenclature. Here is what they mean:

$ ls -l /sys/class/net/
lrwxrwxrwx. 1 root root 0 Oct 23 21:42 enp0s3 -> ../../devices/pci0000:00/0000:00:03.0/net/enp0s3
lrwxrwxrwx. 1 root root 0 Oct 23 21:42 enp0s8 -> ../../devices/pci0000:00/0000:00:08.0/net/enp0s8
lrwxrwxrwx. 1 root root 0 Oct 23 21:42 enp0s9 -> ../../devices/pci0000:00/0000:00:09.0/net/enp0s9
$ lspci |grep -i net
00:03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
00:08.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
00:09.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)

So, "enp0s3" => Ethernet network peripheral #0 on serial port #3. PCI bus numbers will be in order: 3, 8, 9, a(10). Or, 3 = NIC#1, 8 = NIC#2, etc.

$ lshw -C network
...
bus info: pci@0000:00:03.0
logical name: enp0s3
...
$ lspci|grep -i net
00:03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)

The first characters of each line are in the format: [<bus>]:[<slot>].[<func>]

In the above example, the bus is 0x00, the slot is 0x03, and the function is 0x0, where:

bus 
the bus of the PCI device
slot 
the slot of the PCI device
function 
the function of the PCI device