# Single quick lookup (any of these work)
curl -s https://ifconfig.me
curl -s https://icanhazip.com
curl -s https://api.ipify.org
curl -s https://ipinfo.io/ip
# With fallback chain — try several until one responds
get_public_ip() {
local ip
for src in https://ifconfig.me https://icanhazip.com https://api.ipify.org; do
ip="$(curl -fsS --max-time 5 "$src")" && [[ -n "$ip" ]] && { echo "$ip"; return 0; }
done
echo "Could not determine public IP" >&2
return 1
}
ip="$(get_public_ip)"
echo "Public IP: $ip"
Create a free account and build your private vault. Share publicly whenever you want.