Linux Tip: Find Your Outgoing Or External IP Address From Command Line
The command line in Linux is a master tool. It can help you do every task from the smallest ones to the biggest in no time at all. On the flip side, if you are not careful enough, use of command line could break your system. Nonetheless, all linux power users prefer using the command line as things get done faster this way. In this article we will share a short tip with you using which you can find your computer's outgoing or external IP address from command line.
We agree that you can easily find out your computer's external or outgoing IP address from a web based service such as a Whatismyip.com. But lets say you are behind firewalls or proxy server, in this case Whatismyip.com could end up giving you wrong results. For those who do not know what an external (or outgoing) IP address is, it is the IP address which is visible to other computers while you are on the web.
But using this command line method, you will always get the correct external or outgoing IP address of your computer. Open a terminal window and enter this command in order to find out your External or Outgoing IP address:
dig myip.opendns.com @resolver1.opendns.com +short
Once executed, you will be shown your external IP address as the output. You need to be connected for this command to give you an output (quite obvious) Check this screenshot below to find out how the output looks like: