Skip to content

Instantly share code, notes, and snippets.

@dusansimic
Last active September 20, 2017 13:04
Show Gist options
  • Save dusansimic/6145bd3674f7a53c11127bd18b904786 to your computer and use it in GitHub Desktop.
Save dusansimic/6145bd3674f7a53c11127bd18b904786 to your computer and use it in GitHub Desktop.
Get your public ip address with one simple script.
#!/bin/bash
printf "Local: %s\n" "$(ifconfig enp3s0 | grep 'inet ' | awk '{ print $2}')"
printf "Global: %s\n" "$(dig +short myip.opendns.com @resolver1.opendns.com)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment