How to Check Your IP Address in Ubuntu Linux Using the ip Command

Whether you are configuring a web server, setting up an SSH connection, or simply troubleshooting a network issue, knowing your machine’s IP (Internet Protocol) address is a fundamental requirement. In older versions of Linux, the ifconfig command was the standard tool for this job. However, modern Linux distributions, including Ubuntu, have largely deprecated ifconfig in favor of the much more powerful and versatile iproute2 suite. The modern, standard way to check your network configuration is by using the simple ip command.

Finding Your Local IP Address

Your local (or internal) IP address is the address assigned to your Ubuntu machine by your home or office router. It is usually formatted like 192.168.x.x or 10.0.x.x.

  1. Open your terminal application (press Ctrl + Alt + T).
  2. Type the following command:
    ip addr show
    (You can also use the shorthand version: ip a)
  3. Press Enter.

Understanding the Output

The command will output a block of text detailing every network interface connected to your machine. It can look overwhelming, but you only need to focus on a few key parts.

  1. The Loopback Interface (lo): The first entry is usually labelled lo. This is the “loopback” interface (address 127.0.0.1). It is used by the system to talk to itself. You can ignore this for networking purposes.
  2. Your Primary Interface (e.g., eth0, enp3s0, wlan0): Look for the second or third block of text.
    • If you are connected via an Ethernet cable, it will likely be named something starting with en or eth (e.g., enp3s0).
    • If you are connected via Wi-Fi, it will likely start with wl (e.g., wlan0 or wlp2s0).
  3. Finding the IP Address: Once you have identified your active network interface, look a few lines down for the word inet (which stands for Internet network).
  4. The numbers immediately following inet are your local IP address (for example, inet 192.168.1.55/24). The /24 at the end represents the subnet mask; your actual IP address is just the 192.168.1.55 portion.

A Quicker, Cleaner Command

If you find the output of ip a too messy and only want to see the IP addresses without all the extra MAC address and broadcasting data, you can use a slightly different command to format the output cleanly.

Type: ip -brief addr show

This command condenses the information into a neat table. It lists the interface name on the left, its status (UP or DOWN) in the middle, and the IP address clearly on the right, making it incredibly easy to read at a glance.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.