Master How To Find Get Your IP Address in Linux (2026)

0b63979cd9494aa401d1fce2d73bb002
On: December 22, 2025
How To Find Get Your IP Address in Linux

Step-by-step guide on How To Find Get Your IP Address in Linux. Learn commands like ip addr, ifconfig, hostname -I, nmcli, and check IPv4 & IPv6 easily

Learn how to find and get your IP address in Linux with easy, beginner-friendly steps. Discover Linux IP address commands like ip addr, ifconfig, hostname -I, and nmcli, check IPv4 and IPv6 addresses, identify private vs public IPs, and troubleshoot network issues on Ubuntu, CentOS, and other Linux distributions.

How To Find Get Your IP Address in Linux

Introduction to IP Addresses and Their Importance in Linux

Imagine you walk into a coffee shop, sit down with your laptop, and connect to the Wi‑Fi. Your computer is now part of a network. To send and receive data, your system needs an address so other devices and services know where to find you. That address is called an IP address.

In Linux, knowing how to get your IP address is one of the first steps in working with networks. Whether you’re troubleshooting an internet issue, configuring a server, connecting to SSH, or simply checking your network setup, learning how to find your IP address in Linux is essential.

In this article we’ll talk about:

  • What an IP address is.
  • Linux networking basics.
  • How to use commands like ip addr, ifconfig, hostname -I, and nmcli to check IP.
  • How to see IP address in Ubuntu, CentOS, and other distributions.
  • The difference between private IP and public IP.
  • How to find both IPv4 and IPv6 addresses.
  • Troubleshooting and best practices.

By the end, you’ll know exactly how to view your IP address in Linux from the terminal and understand what those numbers mean.

Linux Networking Basics : What You Need to Know

Before we dive into the commands to get your IP address in Linux, let’s cover some basic networking concepts.

What Is an IP Address?

An IP address (Internet Protocol address) is a numeric label assigned to each device connected to a network. It serves two primary purposes:

  1. Identify your device on the network
  2. Allow communication between devices

There are two main types of IP

  • IPv4: Looks like 192.168.1.10
  • IPv6: Looks like fe80::a00:27ff:fe4e:66a1

Both are valid IP addresses, but IPv4 is more common in home networks today.

Private vs Public IP Addresses

  • Private IP: Used inside your home or office network. Not reachable directly from the internet. Example: 192.168.1.x or 10.0.0.x.
  • Public IP: Assigned by your ISP. It’s the address the rest of the internet uses to find your network.

Linux systems often have private IPs on internal networks and access the internet through a shared public IP.

Network Interfaces in Linux

Your system will show network connections through interfaces, like:

  • eth0, eth1: Wired Ethernet interfaces
  • wlan0: Wireless interface
  • lo: Loopback (internal system use)

Each active network interface can have one or more IP addresses (both IPv4 and IPv6).

Linux IP Address Commands — A Step‑by‑Step Guide

Let’s go through the most common commands to check IP address in Linux. Each example is practical and beginner‑friendly.

1. Using ip addr — The Most Complete Way

The ip command is part of the modern Linux networking stack. It replaced older tools like ifconfig.

Basic Command

ip addr

This shows a detailed list of all network interfaces and their IP addresses.

Example Output Explained

When you run:

ip addr

You might see something like:

2: wlan0:  mtu 1500
    inet 192.168.1.15/24 brd 192.168.1.255 scope global dynamic wlan0
    inet6 fe80::1c2d:90ff:fe7a:4f18/64 scope link

Here’s what it means:

  • inet 192.168.1.15/24 — this is your IPv4 address and subnet.
  • inet6 fe80::… — this is your IPv6 address.

This command is ideal if you want a detailed view of all interfaces.

2. Using ifconfig — Classic Command

ifconfig was the old way to view IP addresses on Linux. It’s not installed by default on all distributions, but many users still have it.

Install ifconfig (if needed)

On Ubuntu:

sudo apt install net-tools

On CentOS:

sudo yum install net-tools

Run ifconfig

ifconfig

Example Output

wlan0: flags=4163 mtu 1500
    inet 192.168.1.15 netmask 255.255.255.0 broadcast 192.168.1.255
  • inet 192.168.1.15 — Your IPv4 address.
  • Subnet mask and broadcast address are also shown.

Keep in mind, ifconfig may not show IPv6 addresses by default.

3. Using hostname -I — Clean and Simple

If you just want a quick list of IP addresses without other stuff, try:

hostname -I

Output might look like:

192.168.1.15  fe80::1c2d:90ff:fe7a:4f18

This command shows all IP addresses on your system in a clean, spaced list — no extra text.

Why It’s Useful

  • Quick result without scrolling.
  • Great for scripts and simple checks.

4. Using nmcli — NetworkManager Command

nmcli is part of NetworkManager. It’s useful on distributions like Ubuntu, Fedora, and CentOS if NetworkManager is running.

View IP with nmcli

nmcli device show

This shows detailed information per network interface.

To focus only on IP info, use:

nmcli -p device show

Example Output

You might see:

IP4.ADDRESS[1]:                         192.168.1.15/24
IP6.ADDRESS[1]:                         fe80::1c2d:90ff:fe7a:4f18/64

This is very clear and beginner‑friendly.

Examples: How to See IP Address in Different Linux Distributions

Linux distributions share the same tools, but sometimes setup differs slightly. Here are practical examples.

Ubuntu — Desktop and Server

Ubuntu is one of the most common Linux distributions. You can use all commands covered here.

Check IP Using ip addr

ip addr

Simple IP Only

hostname -I

Check IP with ifconfig

sudo apt install net-tools
ifconfig

Using NetworkManager

nmcli device show

Ubuntu Desktop usually has NetworkManager enabled, so nmcli works well.

CentOS — RHEL Family

CentOS and RHEL often use NetworkManager too, especially on desktop installs.

Check IP (Standard)

ip addr

Using nmcli

nmcli device show

Install ifconfig (Optional)

sudo yum install net-tools
ifconfig

CentOS server installs may not include NetworkManager — but ip addr always works.

Other Linux Distributions

No matter the distribution — Fedora, Debian, Arch, OpenSUSE — these commands work:

  • ip addr
  • hostname -I
  • nmcli (if NetworkManager exists)
  • ifconfig (if installed)

This makes learning how to find IP address in Linux universal.

Difference Between Private IP and Public IP

When you check your IP address in Linux, you usually see your private IP — the one assigned by your router. That’s fine for internal network communication.

But what if you want your public IP — the one other computers on the internet see?

Find Public IP from Terminal

Linux doesn’t show public IP with ip addr because that command deals with local interfaces. To find your public IP, you can query a web service.

Example:

curl ifconfig.me

or

curl ipinfo.io/ip

This displays your public IP in the terminal.

Why Public vs Private Matters

  • Private IP is used inside your network (e.g., 192.168.x.x).
  • Public IP is the internet‑facing address your ISP provides.

Servers and routers need this distinction to manage traffic correctly.

How to Find IPv4 and IPv6 Addresses

Today, many networks support both IPv4 and IPv6. Linux commands show both when available.

IPv4 vs IPv6 Quick Breakdown

FeatureIPv4IPv6
Format4 sets of numbersHexadecimal groups
Example192.168.1.15fe80::1c2d:90ff:fe7a:4f18
Used forMost regular trafficGrowing, modern networks

See Both with ip addr

ip addr

Under each interface you’ll see:

  • inet — IPv4
  • inet6 — IPv6

See IPv4 Only

ip -4 addr

See IPv6 Only

ip -6 addr

These are useful if you only care about one protocol.

Troubleshooting Tips When IP Isn’t Showing

Sometimes when you run commands like ip addr, you might not see an IP address. Here are practical tips:

1. Check If Network Interface Is Up

Run:

ip link show

Look for state:

UP

If it’s down, bring it up:

sudo ip link set eth0 up

Replace eth0 with your interface name.

2. Restart Network Services

On Ubuntu:

sudo systemctl restart NetworkManager

On CentOS:

sudo systemctl restart network

This often reassigns IP addresses.

3. Confirm Cable or Wi‑Fi Connection

For wired:

  • Check physical cable.
  • Make sure router is on.

For Wi‑Fi:

nmcli device wifi list
nmcli device wifi connect YOUR_SSID

4. Request New IP via DHCP

sudo dhclient -v eth0

This forces your system to request a new IP from your router.

Best Practices for Managing and Viewing Linux Network Interfaces

Now that you know commands to find your IP address in Linux, let’s look at some real‑world tips.

Use ip Instead of ifconfig

ip is the modern tool and shows more info. It’s installed by default on all current distributions.

Learn Interface Names

Linux now uses consistent naming like:

  • enp0s3 for Ethernet
  • wlp2s0 for Wi‑Fi

Knowing these helps when running commands.

Use Scripts for Repeated Checks

If you check IP often, add a script like:

#!/bin/bash
echo "Your IPv4 and IPv6 addresses:"
hostname -I

Save as checkip.sh, make it executable:

chmod +x checkip.sh
./checkip.sh

Understand Your IP Addresses

  • If you see 127.0.0.1 — that’s localhost.
  • If you see 169.254.x.x — that means network didn’t assign a proper IP.
  • If you see 192.168.x.x or 10.x.x.x — that’s a private IP.

Knowing these makes interpreting results easier.

Use nm‑connection‑editor on Desktops

If you prefer graphical tools (on Ubuntu desktop), use:

nm‑connection‑editor

This shows network details including IP addresses.

Summary and Key Takeaways

Here’s what you’ve learned about how to find your IP address in Linux:

Linux Networking Basics

  • IP addresses help your Linux machine communicate on networks.
  • You have both IPv4 and IPv6.
  • Private vs public IP matters for internal use vs internet visibility.

Commands to View IP Address in Linux

CommandWhat It Shows
ip addrDetailed IP and interface info
hostname -IQuick list of IPs
ifconfigClassic IP tool
nmcli device showNetworkManager’s detailed view

Each is useful in different situations.

Examples Across Distributions

  • Ubuntu and CentOS support all commands.
  • Use apt or yum to install tools like ifconfig if missing.
  • ip addr always works.

Public vs Private IP

  • You get private IPs on your local network.
  • Use curl ifconfig.me to see your public IP.

Troubleshooting Tips

  • Bring interfaces up with ip link.
  • Restart network services.
  • Renew IP with DHCP.
  • Check cables and Wi‑Fi SSIDs.

Best Practices

  • Prefer ip over old tools.
  • Use scripts for repeated checks.
  • Understand what different IP ranges mean.

Frequently Asked Questions (FAQ) : How To Find Get Your IP Address in Linux

1. How do I find my IP address in Linux?

You can find your IP address in Linux using commands like ip addr, ifconfig, hostname -I, or nmcli. These commands display IPv4 and IPv6 addresses for all network interfaces.

2. What is the easiest Linux IP address command for beginners?

For a quick and clean result, use hostname -I. It shows all assigned IP addresses without extra information.

3. How can I see my private IP in Linux?

Private IPs are usually assigned by your router. Use ip addr or ifconfig to check addresses like 192.168.x.x or 10.x.x.x.

4. How do I check my public IP on Linux?

To find your public IP in Linux, run curl ifconfig.me or curl ipinfo.io/ip in the terminal. This shows the IP your network uses on the internet.

5. Can I view both IPv4 and IPv6 addresses in Linux?

Yes. The ip addr command shows both IPv4 (inet) and IPv6 (inet6) addresses. You can also filter using ip -4 addr for IPv4 or ip -6 addr for IPv6.

6. How to see IP address in Ubuntu specifically?

On Ubuntu, you can run ip addr, hostname -I, or nmcli device show. Ubuntu Desktop also supports GUI tools via NetworkManager.

7. How to see IP address in CentOS?

CentOS users can check IP using ip addr or nmcli device show. If ifconfig is missing, install it using sudo yum install net-tools.

8. What if my Linux IP address is not showing?

Check if the interface is up using ip link show, restart network services (sudo systemctl restart NetworkManager or network), and request a new IP via sudo dhclient -v .

9. What is the difference between private and public IP in Linux?

Private IP is for internal network use (192.168.x.x), while public IP is the internet-facing address provided by your ISP. Commands like ip addr show private IP; use curl ifconfig.me for public IP.

10. Which command is better: ip addr or ifconfig?

ip addr is modern, more detailed, and recommended for all Linux distributions. ifconfig is older, may need installation, and lacks full IPv6 support.

Final Thoughts

Learning how to get your IP address in Linux is a foundational and practical skill. Whether you’re a beginner starting your Linux journey or an experienced user diagnosing network issues, you now have a complete, friendly guide to check your IP, understand what it means, and troubleshoot when things don’t work.

You’re not just memorizing commands; you’re building confidence to interact with Linux networking in real life — over coffee or in production.

If you ever forget a command, remember this:
“ip addr” is usually all you need to get started.

Many engineers start understanding why Yocto is used rather than directly using a Linux OS when they face real interview scenarios. Going through practical Yocto interview questions for professionals helps connect theory with industry expectations.
https://embeddedprep.com/yocto-interview-questions-for-professionals/

Leave a Comment