How to find out the external ip in Linux
—
If you need to find out external IP from Linux command line, you need to do one of next commands:
How to find out the Public IP Address from the Linux Command Line
You need to get external IP address using command curl:
# curl ifconfig.me
# curl ip.appspot.com
# curl icanhazip.com
# curl ip.appspot.com
# curl icanhazip.com
How to get external IP using command wget:
# wget -q -O - ifconfig.me
# wget -q -O - ip.appspot.com
# wget -q -O - icanhazip.com
# wget -q -O - ip.appspot.com
# wget -q -O - icanhazip.com
How to find out external IP Address using DynDNS.org
1. You can get it using utilite wget:
# wget -q -O - checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
2. Using utilite curl:
# curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
3. Using utilite lynx:
# lynx -dump checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//' | sed '/^$/d'