How to get Public IP using CLI?

Posted: | Last updated: | less than 1 minute read

Inception: If you are System user or admin then you might need to get your Server or Laptop's public IP using CLI.

To get your public IP address from the Linux CLI, you can use the following command:


This will make a request to the service, which will return your public IP address as plain text. If you don’t have curl installed, you can install it with your package manager. For example, on Ubuntu and Debian, you can use the following command to install curl:

sudo apt-get install curl