Share

You can determine your public IP address from the Ubuntu command line using various methods. Here are a couple of ways:

  1. Using curl and a web service like ifconfig.me: Open a terminal and type the following command:
   curl ifconfig.me

This will return your public IP address.

  1. Using dig or nslookup to query a DNS service: You can query a public DNS service like Google’s DNS to find out your public IP. For example:
   dig +short myip.opendns.com @resolver1.opendns.com

or

   nslookup myip.opendns.com resolver1.opendns.com

This will return your public IP address.

Either of these methods should give you your public IP address from the Ubuntu command line.


Share