Getting network interface name using IP address could be accomplished by issuing:
$ ip addr show | grep "192.168.1.2" | awk '{print $7}'or another alternative:
ifconfig | grep -B 1 "192.168.1.2" | head -n1 | awk '{print $1}'Both command would output the name of interface such as eth0, eth1, etc.
0 comments:
Post a Comment