It’s quite useful to have at your fingertips the option of getting your public IP address. Here I will give you various commands to get the IP. Note not all of them have IPv6 service, so only works with IPv4.
IPv4 & IPv6
If you have a connection to the Internet with IPv6, by default, it will be used this interface. However you could force the IPv4 use just adding the -4
option to the curl command. Something like curl -4 ip.sb
.
curl icanhazip.com
curl ifconfig.co
curl ip.sb
curl json.myip.wtf
Just IPv4
This services only works with IPv4, but it could be enough for you, (Not for me 😄)
curl ipinfo.io
curl checkip.amazonaws.com
curl checkip.dyndns.org
curl ip-api.com/json