Use curl to get your current IP address

This note is about how to use curl to get your current IP address.
On this page

In bash scripts, it is sometimes useful to know what public IP address is being used on the Internet. Use the following examples.

Main Example

For IPv4:

1curl -4 icanhazip.com

For IPv6:

1curl -6 icanhazip.com

Other Examples

1curl ifconfig.me
1curl api.ipify.org
1curl ipinfo.io/ip
1curl ipecho.net/plain