Get Public IP from Terminal on Ubuntu 22.04 Example
For teams turning “Get Public IP from Terminal on Ubuntu 22.04 Example” into a repeatable delivery task, learn more here can document setup, troubleshooting and review time; managers should interpret those records alongside reliability and completed work, not as a stand-alone score.
Package and operating-system behaviour can change, so verify the commands and supported versions through Ubuntu before running them on a production host.
Hi Guys,
This tutorial shows you Get Public IP from Terminal on Ubuntu 22.04 Example. I would like to show you How to Get Public IP from Terminal on Ubuntu 22.04?. In this article, we will implement a 4 Ways to Find Server Public IP Address in Linux Terminal. Here you will learn Methods to Find Your Public IP address in Ubuntu 20.04 LTS ?. Follow bellow tutorial step of Command to Get the Public IP address of a router.
You can use this post for ubuntu 14.04, ubuntu 16.04, ubuntu 18.4, ubuntu 20.04, ubuntu 21 and ubuntu 22.04 versions.
Step 1: Use Dig command to get public IP address
The Dig along with the OpenDNS will help you in getting your public IP address on the terminal. The below-given command will be used for this purpose:
$ dig +short myip.opendns.com @resolver1.opendns.com
Step 2: Use host command to get public IP address
You can also find the IP address using the host command that gives you a public IP address through DNS lookups. Run the following host command to get a public IP address:
$ host myip.opendns.com resolver1.opendns.com
Step 3: Use wget command to get IP address
You can also get a public IP address using the wget piped with xarg command which is shown below:
$ wget -qO- http://ipecho.net/plain | xargs echo
Step 4: Use curl command to get IP address
Another way to get a public IP address from the terminal on Ubuntu is using the curl command. However, first you will need to install curl using the following command:
$ sudo apt install curl
To construct the virtual environment, run the following command inside the directory:
$ curl ifconfig.co
You can also use the curl command with ifconfig.me and it will give the public IP address on the terminal:
$ curl ifconfig.me && echo
Or you can use the following curl command with icanhazip service to get public IP on your Ubuntu 2.04 terminal:
$ curl icanhazip.com && echo
- How to Zip a Folder in Ubuntu/Linux Using the Command Line?
- How to Add and Delete Users on Ubuntu?
- How to Change Hostname on Ubuntu 22.04?
- How to Install PHP SOAP Extension on Ubuntu 22.04?
- How to Install and Master Django on Ubuntu 22.04?
- How to Install PHP JSON Extension in Ubuntu 22.04?
- How to install PHP Imagemagick on Ubuntu 22.04?
- How to Install PHP Intl Extension in Ubuntu 22.04 ?