If I run the command
ip link | awk '{print $2}'
in Ubuntu 18.04, I get this output:
lo:
00:00:00:00:00:00
wlp1s0:
2c:6e:85:bf:01:00
enp2s0:
14:18:77:a3:01:02
I want it formatted like this (without lo
)
wlp1s0: 2c:6e:85:bf:01:00
enp2s0: 14:18:77:a3:01:02
How do I do this?
ifconfig | grep HW | awk '{ print $1" : "$5 }'
. Since loopback doesn't have aHW
address, grep will ignorelo
.