TLDR; curl ifconfig.co

This website, ifconfig.co, is pretty neat and useful when you play with VPNs and SSH. You can have a more detailed output with http ifconfig.co/json.