Check what is my public ip from command line

Problem:

Need to check what is server’s public ip.

Solution:

Simply run:

# dig +short myip.opendns.com @resolver1.opendns.com
40.89.251.13