To get your public IP you can use websites like www.whatismypublicip.com/Â or just google for it (http://lmgtfy.com/?q=public+ip)
![Get your public IP via shell](https://i0.wp.com/www.ask-sheldon.com/wp-content/uploads/2015/10/Screenshot-10272015-065456-PM-300x250.png?resize=300%2C250)
But you can also get your public IP via the following Linux shell  command (the smart way :-D):
$> curl ifconfig.me/all
This gives you an output like that:
ip_addr: 31.18.198.134 remote_host: ip123456.dynamic.kabel-deutschland.de user_agent: curl/7.35.0 port: 47745 lang: connection: keep_alive: encoding: mime: */* charset: via: forwarded:
Or for IP address only output:
$> curl ifconfig.me/ip
Example output:
31.32.33.242
To install curl you have to run:
$> sudo apt-get install curl
Under CentOs you can call:
$> /sbin/ifconfig
another easy one is:
dig +short myip.opendns.com @resolver1.opendns.com