Always when you are working a lot with CLI environment, Linux particularly, you would like to know the public IP address especially when you were running on NAT environment. Here is a list of command that you can use to determine the public IP of your host via command line.
cURL is mostly available on all Linux distributions, and is the most popular way to determine public IP address of the host. You just need to know the URL or host that will response with the correct public IP as per below:
$ curl ifconfig.me 18.104.22.168 $ curl ipecho.net/plain 22.214.171.124 $ curl ident.me 126.96.36.199 $ curl icanhazip.com 188.8.131.52 $ curl bot.whatismyipaddress.com 184.108.40.206
Basically, command executed on curl can be replace with wget -qO- option, as per below:
$ wget -qO- http://ipecho.net/plain 220.127.116.11
Lynx is a text-based browser which runs like a browser for your CLI
$ lynx checkip.dyndns.org # you will be redirected to a text-based browser
If you have the simplest method apart from what being mentioned here, please share it. I can’t imagine how simple it would be!