[X-Unix] My ip address

Norman Cohen nacohen at mac.com
Fri Feb 18 19:50:44 PST 2005


The other answers to this thread give you your local ip address within 
your LAN if you are behind a router.

Now, if you want to know what address your cable/dsl modem is assigned, 
you can store the following alias in your .bashrc file.

alias myip='curl -s "http://whatismyip.com" | grep "Your IP" | awk 
"{print \$4}"'

Open a new xterm or source ~/.bashrc, and type "myip" without the 
quotes. The alias will go to the whatismyip.com website and parse the 
response, returning your modem's ip address.

Hope this helps,

Norm

Norman Cohen
nacohen at mac.com

"There is still a difference between something and nothing, but it is 
purely geometrical and there is nothing behind the geometry."
Martin Gardner

On Feb 14, 2005, at 4:28 PM, KL Tah wrote:

> Hi,
> Anyone know a slick one-liner in xterm to find out what ip address I'm
> assigned (i.e. Without having to go to System Prefrences)?
>
> Thanks,
> KL
> -- 
>
>
> _______________________________________________
> X-Unix mailing list
> X-Unix at listserver.themacintoshguy.com
> http://listserver.themacintoshguy.com/mailman/listinfo/x-unix
>



More information about the X-Unix mailing list