If you need to find your server’s public IP, using the command line, it’s as simple as one command:

curl whatismyip.akamai.com

You can modify the above command, so it adds a new line after IP:

curl -w "\n" whatismyip.akamai.com

If you have any suggestion, feel free to contact me via social media or email.