Skip to content

Instantly share code, notes, and snippets.

@bluesku
Created February 8, 2021 03:11
Show Gist options
  • Save bluesku/4325e1ae9bc27c2a17ba49fe55908751 to your computer and use it in GitHub Desktop.
Save bluesku/4325e1ae9bc27c2a17ba49fe55908751 to your computer and use it in GitHub Desktop.
Find Your IP Address with DIG
#!/bin/sh
#Shell Varibles
RED='\033[0;31m'
BIGreen='\033[1;92m'
NC='\033[0m'
Bred='\033[1;31m'
# eg.: this command makes the code TXT RED > tput setaf 1
# Use dig command for determining my public IP address:
printf "\n\n\n"
printf "I ${RED}love${NC} Stack Overflow\n\n"
printf ${BIGreen}'Type the following dig (domain information groper) command on a Linux, OS X, or Unix-like operating systems to see your own public IP address assigned by the ISP:\n'${NC} ;
sleep 1 ;
echo ${Bred}'\ngoogle dns query.: '${NC}
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
echo ${Bred}'openDns query.: ' ${NC}
dig +short myip.opendns.com @resolver1.opendns.com
# You should see your IP address on screen. This is the fastest way to find out your IP address without using 3rd party site.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment