Last Updated: August 01, 2023
·
848
· barnettjw

Get external IP in a script

Ever need to get the external IP address of the server a script is running on?

localhost [~] $ curl http://icanhazip.com
129.121.176.228

There's also the more professional looking (yet less fun) alternative URL of http://ifconfig.me/ip