The lazy programmer scripts
scripts that work

Lazy find Linux interface from PCI ID GitHub

It is sometimes hard to find which PCI ID corresponds to which NIC in Linux.

This script shows the mapping between PCI IDs and NICs.

Tested On Ubuntu 18.04.

#!/bin/bash

grep PCI_SLOT_NAME /sys/class/net/*/device/uevent

# will show something like
# /sys/class/net/rename5/device/uevent:PCI_SLOT_NAME=0001:00:02.0
# /sys/class/net/rename6/device/uevent:PCI_SLOT_NAME=0002:00:02.0
# /sys/class/net/rename7/device/uevent:PCI_SLOT_NAME=0003:00:02.0

That's all, folks!

Written by kami on Thursday May 30, 2019
Permalink -

Leave a comment

comments powered by Disqus

« Lazy remove cached favicons in Chrome - Lazy create ISO from folder »