The simplest way to get your external IP from linux shell or from linux command line is to use the following command:
wget http://ipecho.net/plain -O - -q ; echo
Once executed you should simply get an output like this:
123.124.125.126
If you don't have wget installed yet you can install it like this:
apt-get update; apt-get install wget