Created
August 1, 2013 04:39
-
-
Save solidsnack/6128459 to your computer and use it in GitHub Desktop.
Find IPs, on OS X and Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ips { | |
| /sbin/ifconfig | tr '\t' ' ' | # OS X gives us tabs, remove them | |
| sed -n '/^ *inet / { s/// ; p ;}' | # Only IPv4, thanks | |
| cut -d' ' -f1 | # Throw away everything but the addr | |
| sed s/addr:// | # Strip addr: prefix on Linux | |
| fgrep -v 127.0.0.1 # We already know about this one | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment