I just love it when a site does all the work for you. In this case Mactuts+ has a list of 40 Terminal commands to tweak your OS X environment. One gem on the list is:
curl ipecho.net/plain; echo
This command will return your external IP address.
Link: Mactuts+ 40 Terminal tips and tricks you never thought you needed