Know your Public IP from within *nix shell

In case if you want to check the public IP address from within your Linux shell, then you can use either of the following commands to extract the public IP address:

wget -qO- checkip.dyndns.org|sed -e ‘s/.*Current IP Address: //’ -e ‘s/<.*$//'

curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'

This is very useful when you don’t have a GUI and you have IP configured on your Load Balancer.

Advertisements