How to Find Your Public IP Address Using the Command Line
A guide explains that running curl https://ipcomet.com in a terminal prints your public IP address alone, making the output usable in scripts. It covers the same approach on macOS, Linux and Windows, including PowerShell and the curl.exe distinction. Code examples show how to fetch the address from Python and Node.js, with a note that some sites block Python's default User-Agent. The article also describes an endpoint that returns location, ISP and network details as JSON, plus options for choosing IPv4 or IPv6. It closes by listing alternative services and a DNS-based method for checking the address.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in