Last active
June 3, 2024 22:22
-
-
Save yurrriq/7fc7634dd00494072f45 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