You can use either
wget to get your external (or public) IP address from the command line. Both tools will output the same results. In this article we will use curl.
Now, when you want to know your external IP address in command line, you do not want to see anything other than your IP address. You don't want to see HTML code and waste time looking for your IP.
For example, you can run this command:
This will output the entire HTML page including your IP address. Now try to find it! Not fun right?
To fix this issue, you can use one of these sites:
curl -s bot.whatismyipaddress.com; echo;