Check Public IP with curl

Server admins working over SSH have no browser to open Google for IP checks. Here is how to discover outbound public IP from the terminal with curl.

U-Star IP REST API Guide
curl https://www.u-star.org/api/ip

Live API Response Test Sandbox

Click the button above to see the JSON response from the API.

3-Line Summary

  • 1One-line commands for CMD, PowerShell, and Bash to read public IP.
  • 2Essential for headless servers without a GUI browser.
  • 3curl options for timeouts and interface selection explained.

curl Basics for IP Lookup

curl is a CLI tool for HTTP and other protocols. - **Linux/Mac:** `curl https://www.u-star.org/api/ip` - **Windows PowerShell:** `curl https://www.u-star.org/api/ip` The API returns a compact JSON or plain IP response in the terminal.

When curl IP Check Matters on Headless Servers

After logging into a cloud VM, you must know the outbound public IP before asking partners to whitelist your server in their firewall. curl gives that number immediately.

wget and PowerShell Alternatives

If curl is missing: - **wget:** `wget -qO- https://www.u-star.org/api/ip` If PowerShell curl alias conflicts: - **Invoke-RestMethod:** `Invoke-RestMethod -Uri https://www.u-star.org/api/ip`

GOOGLE ADSENSE

Frequently Asked Questions (FAQ)

You probably curled the homepage URL instead of `/api/ip`. The server then streams full HTML and JavaScript into the terminal. Always use the API path `/api/ip` for clean output.
Yes. Examples: `curl --interface eth1 https://www.u-star.org/api/ip` for a specific NIC, or `-x` to route through a proxy for testing.