Skip to content

Instantly share code, notes, and snippets.

@sasha42
Created January 5, 2016 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sasha42/5f6062f373fefdd84808 to your computer and use it in GitHub Desktop.
Save sasha42/5f6062f373fefdd84808 to your computer and use it in GitHub Desktop.
Print external+internal IP (mac)
#!/bin/bash
dig +short myip.opendns.com @resolver1.opendns.com
ifconfig en0 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment