I'm looking for a way to get my IP address using the command prompt in Linux. I know when you type "ifconfig" you can get your local IP address (i.e. 192.168.0.103), but I'm looking for my IP address that I get from my ISP. How can I get this from Linux without having to visit some website?
If your computer is on e.g. a corporate LAN with an address-translating firewall there is unfortunately no information on your computer about the externally visible address. For all your computer knows it has a local IP (e.g. 192.168.0.103) that can be used to connect to any host on the Internet. The address-translating firewall is completely transparent from your computer's point of view.
The only way is to use an external "observer" such as whatismyip.org to help. If you don't like having to access it through a full web browser curl is an alterantive as pointed out by Samuel K
Add this to your ~/.bashrc file on Linux or ~/.bash_profile on Mac.
alias myip='wget http://automation.whatismyip.com/n09230945.asp -O - -q ; echo'
Source will activate the changes you made to your bash file. It's only required once.
Now type 'myip' from command line, and you get the public IP address.
:# myip 220.127.116.11