Skip to content

Instantly share code, notes, and snippets.

@artynet
Last active November 11, 2015 23:47
Show Gist options
  • Save artynet/d9d6f3ed62af81b18f05 to your computer and use it in GitHub Desktop.
Save artynet/d9d6f3ed62af81b18f05 to your computer and use it in GitHub Desktop.
PRINTS MAC ADDRESS OF ETH0
ifconfig eth0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'
cat /sys/class/net/eth0/address
cat /sys/class/net/wlan0/address
PRINT LAST FOUR DIGITS OF THE ABOVE MAC ADDRESS
ifconfig eth0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' | tail -c 6 | sed s/://g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment