Terminal command to get MAC address alone in ubuntu?

 

Terminal command to get MAC

You can access the address file for each device on the /sys virtual filesystem. The MAC address should be in /sys/class/net/<device-name>/address .

to get mac address of any device you can use the command as :

$ cat /sys/class/net/*/address

/sys/class/net/*/address

Similarly we can also use the combination of ifconfig and grep 

 $ ifconfig -a | grep HWaddr | awk '{print $5}' 

 
Terminal command to get MAC address alone in ubuntu?

 Similar commands:


  1. ifconfig -a
  2. ifconfig eth0
  3. ip link show
  4. ip -o link show eth0
  5. ip -o link show |cut -d ‘ ‘ -f 2,20
  6. cat /sys/class/net/*/address