Skip to content

Instantly share code, notes, and snippets.

@samundra
Last active December 27, 2017 09:14
Show Gist options
  • Save samundra/2f7319f802ffff6189da2682e8615533 to your computer and use it in GitHub Desktop.
Save samundra/2f7319f802ffff6189da2682e8615533 to your computer and use it in GitHub Desktop.
Show Local IP
findIp() {
ip=`ifconfig -a | grep inet|grep "192."|tail -1|cut -f2 -d ":"|cut -f1 -d " "`
echo $ip
}
findIp
# Usage:
# chmod +x show-ip.sh
# - ./show-ip.sh
# $ sudo ln -sf /usr/local/bin/show-ip $(pwd)/show-ip.sh
# Then can be used as `show-ip`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment