Return to Snippet

Revision: 12113
at March 2, 2009 17:56 by chrisaiv


Initial Code
#1. Use ifconfig and pipe ( | ) it into grep which will search for the 'inet' field
#2. Pipe the data once again into grep and reverse the logic of the search (-v) to remove 12.7.0.0.1.  Using -v will match all the lines that do not match 127.0.0.1 (aka loopback)
#3. Use Cut to show the second field in the line, using spaces as a delimiter

ifconfig | grep 'inet ' | grep -v 127.0.0.1 | cut -d\   -f2

Initial URL
http://www.showipaddress.com/

Initial Description
This example uses the 'ifconfig' but with a little bit of grep to weed out the crap

Initial Title
Figure out your Internal / External Ip Address using Terminal

Initial Tags


Initial Language
Bash