Before we start, let's understand what an IP address is.

An IP (or Internet Protocol) address is a numerical digit assigned to each device connected to the computer network (using the Internet Protocol).

There are two types of IP address versions: IPv4 and IPv6, with IPv4 being the older and IPv6 the newer. IPv6 addresses the limited address space by using a more numeric value for device assignment.

The IP address would always be unique for each device connected to the same network and would be linked with the device's MAC address in the ARP table.

There are two types of IP addresses: private and public. The private IP address is used within a local network (such as in a home with a router), where each device is assigned a unique private IP address within the sub-network. However, the public IP address is the more important one that allows communication over the internet.

So, if you plan to make your local web server accessible over the internet, you can discover your private IP address, then port forward the service corresponding to that IP address in the router page, and then use the public IP address from a different machine to access your web server.

Check the Private IP Address in Ubuntu [CLI Method]

The fastest and simplest way to check the IP addresses of all attached network devices is by executing the following command:

$ ip a


$ ip addr show


check all private address in ubuntu

It will list the private IPv4/IPv6 addresses for all network devices, including loopback and network interface (in my case, ens33).

To check the private IPv4/IPv6 addresses for specific network devices, such as the network interface named ens33, you can use the corresponding command.

$ ip a s ens33


$ ip addr show ens33


check the private IP address for network interface

Just get the IPv4 address

The previous method is a bit overwhelming for beginners, so you can use the hostname command to quickly and easily get the IPv4 address for the attached network interface device on your Linux system.

$ hostname -I

The above command will only provide the private IP address.

check ip address using hostname command

Check the Private IP Address in Ubuntu [GUI Method]

If you're not comfortable with the command line, you can visually check the private IP address. To do so, open your "Settings", go to "Network", and click the "gear icon" next to your connection.

opening the network conection in ubuntu

It will open a window with additional settings and information regarding your network, including your private IPv4 and IPv6 addresses.

check the private ip address in ubuntu using GUI

The screenshot above is from the latest Ubuntu 24.03, but if you're using an older version like Ubuntu 23.03, the method remains the same; only the position of the option may vary slightly.

Check the Public IP Address in Ubuntu

To check your public IP address (used to communicate over the internet, server, etc.), you can use the curl command to send a request to the provided URL, which will display your public IP address on the terminal screen.

$ curl


check the public ip address in ubuntu

Along with your public IP address, you'll receive extra details like city, region, country, location, postal code, timezone, etc.

If your system doesn't have curl installed, you can open your terminal and execute the following command to install it:

  • On Debian, Ubuntu, Linux Mint, Zorin OS, Pop!_OS, etc.
  • sudo apt install curl
  • On RHEL, Fedora, CentOS, Rocky Linux, AlmaLinux, etc.
  • sudo dnf install curl
  • On Arch, Manjaro, Black Arch, Garuda, etc.
  • sudo pacman -S curl

You can also quickly find your public IP address by searching "what is my IP address" on Google or by visiting the page directly.

That's it. In this article, you have learned how to check your private and public IP addresses on Ubuntu and other Linux distros such as Linux Mint, Fedora, Rocky Linux, openSUSE, Arch, and Manjaro using CLI and GUI methods.