Linux command to know your public IP
To know your public IP from linux terminal or ubuntu terminal you can use curl command.
curl https://ipinfo.io/ip
This will show your public IP address.
you can also try using:
curl -s https://ipinfo.io/ip
This will show you public IP address and it's fail proof. So even if curl command fails, it will fail silently without failing the whole process.