On my mac when I run ip on Terminal, my external IP address is sent to the clipboard like a charm. All you need is create an alias using curl, a web service that returns your remote IP and pbcopy.
Just add the following line on ~/.profile:
alias ip="curl -s http://ipecho.net/plain | pbcopy"
Linux users can replace pbcopy with xsel or xclip like jacaetevha posted here.