[X-Unix] My ip address

Scott scott-xlists at scotist.com
Wed Feb 16 16:54:10 PST 2005


ifconfig  |awk '/inet / {print $2}'

This will include loopback, ethernet, airport, etc. Note the space in 
/inet /. Without it, you get the ipv6 address as well.
If you want to exclude the local loopback address:

ifconfig  |awk '/inet / {print $2}' |grep -v 127.0.0.1

Or if you know what interface,

ifconfig en1  |awk '/inet / {print $2}'

Use en1 for airport, en0 for ethernet.

-- 
Scott


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)?



More information about the X-Unix mailing list