Slug: os-x-tip-get-current-airport-ip Date: 2004-11-19 Title: “OS X Tip: Get Current Airport IP” layout: post

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.