How to use curl to get public IP address - LinuxConfig.org

The curl command on Linux systems is commonly used to download and upload files to or from a remote server. Another interesting thing we can use it for is to determine the public IP address of our system.


This is a companion discussion topic for the original entry at https://linuxconfig.org/how-to-use-curl-to-get-public-ip-address

If you don’t want to deal parsing json, etc. you can simply do

curl ipaddress.ai