Blog

Get public IP address from Linux command line

Linux

To get the public IP of a computer or server on a Linux command line, you can use the following command for IPV4 addresses:

curl ipinfo.io/ip

You can obtain extended information about the IPV4 address (as JSON) via:

curl ipinfo.io

If you want to find out the public IPv6 address instead, you can use the following command:

curl v6.ipinfo.io/ip

For IPv6, you can also get the extended information via:

curl v6.ipinfo.io