Finding Interface Name Using IP Address

Tags: April 23, 2014 7:47 AM

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.

Reference

Share on Facebook Twitter

0 comments:

Post a Comment