There is a website at ifconfig.co which can be used to get your public IP address. This is a reasonably nice service, and a nice alternative to Googling “what is my IP address”.
One nice thing about this service is that it also works on the command line. When calling it with curl, it will return a plain-text response, making it possible to use in scripts.
curl -4 ifconfig.co 10.20.30.40
I’m guessing that it’s using the User-Agent header to detect whether the response is coming from curl. Setting it to something else will return the response as HTML:
curl -H 'User-Agent: Mozilla and stuff' ifconfig.co <see all the angle brackets fly>
Even so, this is a very nice touch with this service.
✍️ Reply by email