Skip to main content

Command Palette

Search for a command to run...

How to Check IP Address in Linux Ubuntu

Updated
5 min read

Checking your IP address in Linux Ubuntu is something you might need to do often. Whether you're setting up a server, troubleshooting network issues, or just curious about your system's network details, knowing how to find your IP address is essential. In this guide, I’ll walk you through easy methods to check your IP address on Ubuntu, both using the command line and graphical tools.

You don’t need to be a Linux expert to follow along. I’ll explain each step clearly and provide examples so you can try them yourself. By the end, you’ll be confident in finding your IP address anytime you want.

Understanding IP Addresses on Ubuntu

Before diving into commands, it’s helpful to understand what an IP address is. Your IP address is a unique number assigned to your device on a network. It helps other devices find and communicate with your computer.

Ubuntu systems usually have two types of IP addresses:

  • Private IP Address: Used within your local network (like your home Wi-Fi).
  • Public IP Address: The address visible on the internet, assigned by your internet service provider.

Knowing which IP you want to check is important because the methods differ slightly.

Checking IP Address Using Terminal Commands

The terminal is a powerful tool in Ubuntu. Here are the most common commands to check your IP address.

Using ip Command

The ip command is the modern way to view network information on Linux.

  1. Open the Terminal (you can press Ctrl + Alt + T).
  2. Type the following command and press Enter:

    ip addr show
    
  3. Look for the section related to your network interface, usually named eth0 for wired or wlan0 for wireless connections.

  4. Find the line starting with inet. The number next to it is your IP address.

For example:

3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    inet 192.168.1.10/24 brd 192.168.1.255 scope global dynamic wlan0

Here, 192.168.1.10 is the IP address.

Using ifconfig Command

ifconfig is an older command but still widely used.

  1. Open Terminal.
  2. Type:

    ifconfig
    
  3. Look for your network interface and find the inet addr or inet field.

Note: On some Ubuntu versions, ifconfig may not be installed by default. You can install it with:

sudo apt install net-tools

Using hostname Command

For a quick way to get your IP address, use:

hostname -I

This command returns all IP addresses assigned to your system separated by spaces.

Using nmcli Command

nmcli is a command-line tool for NetworkManager.

Run:

nmcli device show

Look for IP4.ADDRESS[1] under your active network device.

Checking Public IP Address

Your public IP address is different from your local IP. To find it, you can use online services directly from the terminal.

Using curl

If you have internet access, run:

curl ifconfig.me

or

curl icanhazip.com

These commands fetch your public IP from external servers.

Using dig

Another way is to use the dig command:

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

This queries OpenDNS servers to return your public IP.

Checking IP Address Using Ubuntu GUI

If you prefer not to use the terminal, Ubuntu’s graphical interface makes it easy.

Using Settings

  1. Click on the network icon in the top-right corner.
  2. Select Settings or Network Settings.
  3. Choose your active connection (Wi-Fi or Wired).
  4. Click the gear icon next to the connection.
  5. A window will open showing details including your IPv4 and IPv6 addresses.

Using System Monitor Tools

Some Ubuntu versions include network monitoring tools that display IP addresses and other network info.

Troubleshooting IP Address Issues

Sometimes, you might not see an IP address or get unexpected results. Here are some tips:

  • No IP Address: Check if your network cable is plugged in or Wi-Fi is connected.
  • IP Address Starts with 169.254: This means your system failed to get an IP from the DHCP server.
  • Use sudo if permission denied: Some commands may require administrative rights.

Summary Table of Commands to Check IP Address

CommandDescriptionNotes
ip addr showShows detailed IP infoModern and preferred method
ifconfigDisplays network interfacesMay require installation
hostname -IShows IP addresses assignedQuick and simple
nmcli device showShows network device infoUses NetworkManager
curl ifconfig.meFetches public IP from internetRequires internet connection
dig +short myip.opendns.com @resolver1.opendns.comQueries public IP via DNSAlternative to curl

Why Knowing Your IP Address Matters

Understanding your IP address helps you:

  • Configure network settings.
  • Set up remote connections like SSH.
  • Troubleshoot connectivity problems.
  • Manage firewall and security rules.

If you’re running servers or hosting services on Ubuntu, knowing your IP is crucial for accessibility.

Additional Tips for Managing IP Addresses on Ubuntu

  • Use static IP addresses if you want your device to keep the same IP.
  • Use DHCP for automatic IP assignment.
  • Check your router’s admin page to see all connected devices and their IPs.
  • Use tools like nmap to scan your network for active IPs.

Conclusion

Now you know several easy ways to check your IP address on Ubuntu. Whether you prefer the terminal or the graphical interface, you can quickly find both your private and public IP addresses. Using commands like ip addr show or GUI settings, you’ll always have the network info you need.

Remember, your IP address is key to managing your network connections and troubleshooting issues. Keep this guide handy, and you’ll never be stuck wondering how to find your IP on Ubuntu again.

FAQs

How do I find my IP address in Ubuntu using the terminal?

Open Terminal and type ip addr show. Look for the inet entry under your network interface to find your IP address.

What is the difference between private and public IP addresses?

Private IPs are used inside your local network, while public IPs are assigned by your ISP and visible on the internet.

Can I check my public IP address without a browser?

Yes, use terminal commands like curl ifconfig.me or dig +short myip.opendns.com @resolver1.opendns.com.

What if ifconfig command is not found on Ubuntu?

Install it by running sudo apt install net-tools in the terminal.

How do I check my IP address using Ubuntu’s graphical interface?

Go to the network icon, open Settings, select your active connection, and click the gear icon to see IP details.

More from this blog

L

LinuxBloke | Linux Tips, Tricks & Troubleshooting

672 posts