Debian find external ip address cli

There is a quick cli command to determine the external IP address of your Debian machine through the command-line interface.
If you are connected behind a router, then the ifconfig command will give you the internal ip address of your machine.
You can ask some website what your public IP address is using curl and extract the information you need by issuing the following command.

curl -s | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'  

or even shorter:


that’s all !

Leave a Reply

Your email address will not be published. Required fields are marked *