How to know your live/Public ip by command line

Run the below command in terminal to know your public ip address

dig -4 @resolver1.opendns.com -t a myip.opendns.com +short