How To Find My Public IP Address In Ubuntu Command Line

This tutorial explains how to find my public ip address in Ubuntu Linux command line. If you want to check public ip in Ubuntu command line, here is the command to use.

What is Public IP Address

Your public IP address is the IP that is logged when you visit websites or use any other services on the Internet. It differs from your private IP address, which varies by individual device as each device is assigned a private IP address.

A public IP address is a unique address assigned to a device by an Internet Service Provider (ISP). It serves as an identifier for your device on the internet and allows other devices to connect and communicate with it.

Public IP addresses are required for devices that need to be directly accessible from the outside world, such as servers or devices hosting services like websites, mail servers, etc.

How To Check Ip Address In Ubuntu Terminal

To check the internal IP address on Ubuntu system run the following command:

$ ip a

To display the currently used DNS server IP address, run the following command:

$ systemd-resolve --status | grep Current

To display the default gateway IP address run the following command:

$ ip r

Find Public IP Address in Ubuntu

You can use wget command to find public ip address in Ubuntu. As we all know that the wget command is used to download files from the internet.When you execute wget command it will show your public IP. In the example shown below I have used amazonaws to download/retrieve file and thus show my public ip address:

wget -O - -q https://checkip.amazonaws.com

You can also use the dig command to display DNS information including the public IP address of your system via an external DNS server. You can use the following command to show public IP address of your system:

dig +short myip.opendns.com @resolver1.opendns.com

Find Local Ip Address

To display wireless network IP address:

  1. Open Settings and navigate to Wi-Fi in left pane.
  2. Click on the gear icon after the connected wifi network.
  3. In the pop-up it shows the detailed information including your IP address.

To display the wired network IP address:

  1. Open Settings and navigate to Network in left pane.
  2. Click on the gear icon under connected wired network.
  3. In the pop-up it shows the detailed information including your IP address.

Remember that your public IP address may change periodically or when you reconnect to the internet, especially if you have a dynamic IP assigned by your ISP. Therefore, it’s always advisable to confirm your IP address whenever needed.

Original Article