Created
March 9, 2021 11:15
-
-
Save timhughes/411c3684a4cd8101288e041d98e3d455 to your computer and use it in GitHub Desktop.
Show real network interfaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for f in $(find /sys/class/net -type l -not -lname '*virtual*' -printf '%p\n'); do | |
dev=$(basename "$f") | |
driver=$(readlink "$f/device/driver/module") | |
if [ "$driver" ]; then | |
driver=$(basename "$driver") | |
fi | |
addr=$(cat "$f/address") | |
operstate=$(cat "$f/operstate") | |
printf "%11s|[%s]|%10s|(%s)\n" "$dev" "$addr" "$driver" "$operstate" | |
done|sort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment