↑ ↓ select, Enter open, Esc close

Find the public IP address of a server

user@server
curl -4 -s https://icanhazip.com

Asks an external service which address the request comes from and prints only the IP. Useful behind NAT, on cloud servers with a private address on the interface or to find the IP for an allowlist. With -6 instead of -4, the IPv6 address appears.

Note: The request goes to a third party (operated by Cloudflare).

Also searched as

  • what is my public ip linux command
  • get external ip address curl
  • find server public ip behind nat

Related one-liners

All in Network

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.