ubuntu check ip

An IP Address is a unique identifier assigned to a device to identify it on a network. Your devices have private IP addresses that are necessary for communication within the local network (file sharing, remote access, etc.).

Similarly, your ISP assigns your gateway a public-facing external IP address that identifies it on the larger network (internet). There are multiple ways to find the private and public IP addresses in Ubuntu.   

Use IP Command to Check IP

The ip command is used to view and manage various network configurations. One of its simpler uses is to check the IP addresses assigned to various network interfaces. inet (Internet Protocol Family) and inet6 represent the IPv4 and IPv6 addresses respectively.

ip address show

Note: If you don’t recognize the interface names, run nmcli device status first.

You can use the ‘up’ subcommand to only show active interfaces.

ip address show up

Similarly, you can omit the ‘show’ subcommand and abbreviate ‘address’. This means the following commands will return the same output as earlier.

ip addr
ip a

Finally, for better readability, you can filter the output like so

ip -f inet -o addr

Use Hostname Command

The hostname command is normally used to check or set the host, domain, or node names of the system. But with the --all-ip-addresses flag, you can also use it to check the network addresses of the host.

hostname -I

Note: This method won’t display IPv6 link-local addresses.

Check via NetworkManager

The NetworkManager applet provides an easy way to check the IP address without using the terminal.

  1. Launch the Settings app and switch to the Network (wired) or WiFi tab.
    ubuntu network settings
  2. Click on the Settings cog and check the IP address.
    ubuntu ipv4 address

You can use NetworkManager’s command-line version to check an interface’s IP address as well, but the process is longer than the previous methods.

First, check the connection profile with

nmcli con show

Specify the connection name and check the IP address like so

nmcli con show id ‘Wired connection 1’ | grep ipv4.addresses

Check Public IP from Terminal

Users commonly find their public IP address from the router settings page, or by visiting sites like whatismyipaddress.com. But it’s also possible to check it directly from the terminal using through requests.

curl icanhazip.com
curl ipinfo.io
curl ifconfig.me
curl whatismyipaddress.com
Anup Thapa

Senior Writer

Anup Thapa is a Linux enthusiast with an extensive background in computer hardware and networking. His goal is to effectively communicate technical concepts in a simplified form understandable by new Linux users. To this end, he mainly writes beginner-friendly tutorials and troubleshooting guides. Outside of work, he enjoys reading up on a range of topics, traveling, working out, and MOBAs.