Get public IP address from the terminal

icanhazip is a simple website that does nothing but display your IP address. The below command restricts to the IPv4 address.

curl -4 -s -X GET "https://icanhazip.com"