How To Find Out Your Public IP Address From Command Line Interface on both Windows and Linux

To find the your public IP address from command line (CLI) you can use the below commands for Linux and Windows Operating systems.




These 2 commands will generate web request and show the ip address as the response of the request.


dig +nocomments +noquestion +noauthority +noadditional +nostats | grep -oE “\b([0-9]{1,3}\.){3}[0-9]{1,3}\b”

This command runs DNS query and show the resolved ip address. The dns query to using the DNS resolver outputs the public IP address from where the DNS query is generated.

Please note the period (.) at the end of the, this makes sure that the DNS suffix is not added to the query and query is absolute.


nslookup | find “Address”

This outputs two IP addresses and the second IP address will be your public IP address

1 comment

  1. I have noticed you don’t monetize your website, don’t waste your traffic, you can earn extra
    cash every month. You can use the best adsense alternative for any type of website (they approve
    all websites), for more details simply search in gooogle: boorfe’s tips monetize your website

Leave a Reply

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