How To Find My Public IP Address From Linux CLI
Type the following dig (domain information groper) command on a Linux, OS X, or Unix-like operating systems to see your own public IP address assigned by the ISP:
dig +short myip.opendns.com @resolver1.opendns.com
You can also type:
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com