jcadima
3/28/2017 - 8:49 PM

Find public IP address

Find public IP address

https://www.cyberciti.biz/faq/how-to-find-my-public-ip-address-from-command-line-on-a-linux/


in bashrc create a function:


function myip() {
	myip="$(dig +short myip.opendns.com @resolver1.opendns.com)"
	echo "Your Public IP: ${myip}"
}

source bashrc, then call this func:
  
$ myip