Use the below code to check your public IP from your linux console.

wget -q -O – checkip.dyndns.org|sed -e ‘s/.*Current IP Address: //’ -e ‘s/<.>