I use this command to get the name of my network interfaces and their mac address
ip -o link | awk '$2 != "lo:" {print $2, $(NF-2)}' | sed 's_: _ _'
out:
enp2s0 XX:XX:XX:XX:XX:XX
wlp1s0 YY:YY:YY:YY:YY
and this one to get the IP:
ip addr show $lan | grep 'inet ' | cut -f2 | awk '{ print $2}'
out:
127.0.0.1/8
192.168.1.23/24
or this one:
ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}'
or another:
ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1
out:
192.168.1.23
What command can I use to know (the order is not relevant):
interface name | IPv4 address | MAC address
example:
enp2s0 192.168.1.23 XX:XX:XX:XX:XX:XX
in a single line, but only from active interfaces (except lo) (for ubuntu 20.04)?
I have tried this solution but it did not work for me