How to find your public IP with curl
4ip shows the public IP address it sees for your request. Run the first command before and after connecting to a VPN to see if the address changes.
Just the IP address
curl -fsS https://4ip.su/ipThe command prints the address on one line with a trailing newline. Use it in your terminal or scripts.
Connection details
curl -fsS https://4ip.su/detailThe text response includes available details about the country, city, network owner, ASN, and 4ip node.
Read the IP from JSON
curl -fsS https://4ip.su/json | jq -r .ipPipe the response to jq to extract the ip field. This command requires jq.