[X-Unix] Re: My ip address

Craig craig at craigwdesigns.com
Thu Feb 17 15:36:05 PST 2005


On Feb 17, 2005, at 2:02 AM, Peter Dyballa wrote:

>
> Am 17.02.2005 um 01:32 schrieb 
> x-unix-request at listserver.themacintoshguy.com:
>
>> 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)?
>
> ifconfig -a | grep -w inet | grep -v ' 127' | awk '{print $2}'
>
> (Similiarly for IPv6)
> --
>

here's two that rely on the whatismyip.com website:

#using lynx --dump:
url="whatismyip.com"
/sw/bin/lynx --nocolor --dump $url | head -10 |  grep "Your IP" |  awk 
'{print $4}'

# using curl:
curl -s "http://whatismyip.com" | grep "Your IP" | awk '{print $4}'



More information about the X-Unix mailing list