1 min read
Get public IP with Curl
Getting the public IP of your machine (running in the cloud) is simple. You probably find yourself on the command line and want to check if a DNS entry is resolved correctly. Login into the hoster’s dashboard and checking the public IP there is too much of hassle.
Simply run this command to get the public IP of your machine:
janikvonrotz@cratos ➜ ~ curl ifconfig.me 22.214.171.124
The website https://ifconfig.me/ simply returns the IP if queried with curl.
You can also run
curl ifconfig.me/all to get more details.
Tags: linux , curl , ipv4
Improve this page
Show statistic for this page