-
-
Save gaukas/629f0789c230af489511f62738e0886e to your computer and use it in GitHub Desktop.
Get Public IP Address in Terminal
This file contains 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
#!/bin/bash | |
# Slow | |
curl -s ifconfig.me | xargs echo -n | |
# Faster | |
curl -s icanhazip.com | xargs echo -n | |
# API: http://api.ident.me | |
curl ident.me | |
# Fastest? | |
curl ipecho.net/plain | |
# IPv4 | |
curl -s ipv4.icanhazip.com | xargs echo -n | |
curl -s ipv4.ipogre.com | xargs echo -n | |
# IPv6 | |
curl -s ipv6.icanhazip.com | xargs echo -n | |
curl -s ipv6.ipogre.com | xargs echo -n | |
# Fancy | |
printf "GET /plain HTTP/1.1\nHOST: ipecho.net\nBROWSER: web-kit\n\n" | nc ipecho.net 80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment