How to detect an Unix-based server's own external IP address via command line?

wget -qO- http://ipecho.net/plain ; echo

askubuntu.com/a/145017