How to check wan ip from Linux command prompt

I need to find out my wan IP address from Linux command prompt. My modem changes IP address every day. Is it possible to use Linux command to get wan IP address?

Try the following commands to get your public IP address assigned by your ISP to your router:

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

OR

dig TXT +short o-o.myaddr.l.google.com @ns1.google.com

OR

host myip.opendns.com resolver1.opendns.com

See
https://www.cyberciti.biz/faq/how-to-find-my-public-ip-address-from-command-line-on-a-linux/