Get interface name of ip address using bash

The following command will return the interface name of a particular ip address (x).

ip addr show | grep xxx.xxx.xxx.xxx | cut -f2 | awk '{ print $7 }' | head

You may also like

Leave a Reply

Your email address will not be published. Required fields are marked *