Check your IP adress in the terminal

29 Mar 2011

Here is a simple way of finding out what WAN IP adress you have, according to an external source, through the terminal.


A file called n09230945.asp will now have appeared in your current working directory containing your IP adress.

A find got a much cleaner solution as a tip in the comments.
I put these commands in the .bash_profile file in my home directory.
function myip(){
echo ""

(To reaload the .bash_profile file without rebooting write source .bash_profile and the settings will be reread).
Now I am able to check the IP adress by writing
in the terminal and get the output directly in the terminal.

blog comments powered by Disqus