How to View the Current IP Address in Ubuntu Linux Using the ip Command

Whether you are configuring a local web server, setting up an SSH connection, or troubleshooting network connectivity, knowing the IP address of your Ubuntu Linux machine is a fundamental requirement. For many years, Linux users relied on the classic ifconfig command to find this information. However, ifconfig has been officially deprecated in modern Linux distributions. The standard, modern tool for network configuration and information gathering is the powerful ip command.

Finding Your Local IP Address

The local IP address (often starting with 192.168.x.x or 10.x.x.x) is the address assigned to your computer by your local router. This is what you need to connect to your Ubuntu machine from another computer on the same home or office network.

To view your IP address, open your terminal and type the following command:

ip addr show

Press Enter.

Understanding the Output

The output of this command can look overwhelming at first glance, as it displays detailed technical information for every network interface on your system.

  1. Look for the block of text starting with a number. The first interface is usually 1: lo. This is the “loopback” interface (127.0.0.1), which your computer uses to talk to itself. You can ignore this.
  2. Look for the next block. The name of your actual network interface will vary. If you are connected via an Ethernet cable, it often starts with an “e” (like eth0, enp3s0, or eno1). If you are using Wi-Fi, it usually starts with a “w” (like wlan0 or wlp2s0).
  3. Underneath the name of your active interface, look for the line that begins with the word inet.
  4. The number immediately following inet is your local IP address. It will look something like inet 192.168.1.45/24.

Your IP address is the number before the slash (e.g., 192.168.1.45). The /24 is the subnet mask indicator.

The Shortcut Command

If ip addr show feels too long to type, the ip command allows for shorthand abbreviations. You can simply type:

ip a

This will produce the exact same detailed output, saving you a few keystrokes.

How to Show Only the IP Address (Clean Output)

If you are writing a bash script or just hate reading through the dense block of text to find that one specific number, you can use the -brief flag to compress the output into a very clean, easy-to-read table.

Type the following command:

ip -brief addr show

This will output a simple, single-line summary for each interface, clearly displaying the interface name, its status (UP or DOWN), and its IP address.

Get the best tech tips delivered straight to your inbox.

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