Skip to content

Instantly share code, notes, and snippets.

@timhughes
Created March 9, 2021 11:15
Show Gist options
  • Save timhughes/411c3684a4cd8101288e041d98e3d455 to your computer and use it in GitHub Desktop.
Save timhughes/411c3684a4cd8101288e041d98e3d455 to your computer and use it in GitHub Desktop.
Show real network interfaces
#!/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