Skip to content

Instantly share code, notes, and snippets.

@amitsaha
Created March 21, 2014 01:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitsaha/9677822 to your computer and use it in GitHub Desktop.
Save amitsaha/9677822 to your computer and use it in GitHub Desktop.
Find MAC address of all the network interfaces
import os
sys_net = '/sys/class/net'
for dev in os.listdir(sys_net):
with open(os.path.join(os.path.join(sys_net, dev), 'address')) as f:
print dev, f.read(),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment