monkinetic weblog

Steve Ivy's Weblog - Since 1999 - XII Ed.

OS X Tip: Get Current Airport IP

I got a bit of help from the denizens of IRC (crschmidt, kpried) in creating a little bit of shell code that, when run, will get the current IP address of en0 (on my Powerbook that's the Airport) and 1) put it on the clipboard, and 2) print it out. This should go on one line in your .bash_profile.

alias ip='/sbin/ifconfig en1 inet | grep inet | sed -e "s/.inet (.) netmask.*/1/" | tr -ds "n" "" | tee /dev/tty | pbcopy; echo'

If you're running tcsh, modify as necessary.

My name is Steve Ivy and I write about technology, the open web, social software, and general nerdity on monkinetic.com. You should follow me on Twitter or subscribe to this blog if you like what you're reading. I spend my days hacking Movable Type, python, Django, and various other efforts at Wallrazer. This is my personal site.