How to Show Your IP Address in Linux

Knowing your IP address in Linux is one of those fundamental tasks that comes up constantly — whether you're configuring a server, troubleshooting a network issue, setting up SSH access, or just getting your bearings on a new machine. The good news: Linux gives you several ways to find it, each suited to different situations and system configurations.

What "IP Address" Actually Means in This Context

Before diving into commands, it's worth clarifying what you're looking for. Your Linux machine likely has more than one IP address:

  • Local (private) IP address — assigned by your router, visible only within your network (e.g., 192.168.1.x or 10.0.0.x)
  • Public (external) IP address — assigned by your ISP, visible to the outside internet
  • Loopback address — always 127.0.0.1, used internally by the system itself
  • IPv4 vs. IPv6 — modern systems often have both; commands will show either or both depending on flags you use

Most people asking this question want their local network IP — what you'd use to connect to this machine from another device on the same network.

The Main Commands for Showing Your IP Address 🖥️

ip addr — The Modern Standard

The ip command is the current recommended tool on most Linux distributions. It replaced the older ifconfig command and comes pre-installed on virtually all modern systems.

ip addr 

Or the shorthand:

ip a 

This outputs all network interfaces and their assigned addresses. Look for your active interface — typically named something like eth0 (wired), ens33, enp3s0, or wlan0 (wireless). Your IPv4 address appears after inet, and your IPv6 address appears after inet6.

To filter output and show only IPv4 addresses:

ip -4 addr 

To show only a specific interface (replace eth0 with your interface name):

ip addr show eth0 

hostname -I — Quick and Clean

If you just want the IP address with no extra output, this is often the fastest option:

hostname -I 

This prints all IP addresses assigned to the host, space-separated, without interface names or other metadata. It's useful in scripts or when you need a quick copy-paste result.

ifconfig — The Older Classic

On older distributions or systems where net-tools is installed, ifconfig still works:

ifconfig 

If the command isn't found, you can install net-tools via your package manager (apt, dnf, yum, etc.). The output format differs from ip addr but contains the same core information — look for inet addr or inet followed by the address.

Finding Your Public IP Address

None of the above commands will show your public IP — that requires reaching an external service. Common approaches from the terminal:

curl ifconfig.me 
curl icanhazip.com 
dig +short myip.opendns.com @resolver1.opendns.com 

These query external services and return the IP address your traffic appears to come from on the internet. This is particularly relevant if you're behind NAT, a router, or a VPN.

Variables That Affect What You'll See

The output you get depends on several factors, and understanding them helps you interpret results correctly.

VariableHow It Affects Results
Network interface typeWired, wireless, virtual, and loopback interfaces each appear separately
DHCP vs. static IPDHCP assigns addresses dynamically; static addresses are manually configured and won't change
VPN or tunnelAdds virtual interfaces (e.g., tun0, vpn0) with their own addresses
Multiple NICsServers often have several network cards — each gets its own address
IPv4 vs. IPv6 preferenceSome systems prioritize IPv6; commands show both unless filtered
Distribution and versionInterface naming conventions vary (eth0 vs. enp3s0) across distros and kernel versions

When Results Look Unexpected

A few scenarios that commonly cause confusion:

No IP address showing: The interface may be down or not connected. Check interface status with ip link — an interface showing DOWN isn't active on the network.

Multiple addresses on one interface: This is normal and intentional in some configurations — servers often bind multiple IPs to a single interface for hosting multiple services.

Address starts with 169.254.x.x: This is an APIPA address, meaning the system tried to get a DHCP address and failed. It suggests a network configuration problem rather than a normal assigned address.

Different address than expected: If you're connected through a VPN, the local IP shown may belong to the VPN's virtual network rather than your physical network adapter.

Interface Names Vary by System 🔍

One common stumbling block is that interface names aren't consistent across all Linux systems. Older naming conventions used eth0, eth1, wlan0. Modern systems using predictable network interface names (via systemd) produce names like enp2s0, ens3, or wlp3s0. The naming is based on physical location and hardware characteristics rather than detection order.

Running ip link (without addr) gives you a clean list of all interfaces and their current state, which helps you identify which name to use in more targeted commands.

Server vs. Desktop Considerations

On a desktop machine, you typically have one or two active interfaces — one wired or wireless connection, and the loopback. The IP address you want is straightforward to identify.

On a server, the picture is often more complex: multiple physical interfaces, bonded or bridged connections, virtual machine network adapters, container networking (Docker creates its own interfaces), and VPN tunnels can all coexist. The same commands apply, but interpreting which address is "the one you want" depends entirely on what the server is doing and how it's connected.

Your specific distribution, kernel version, network configuration, and whether you're working locally or through a remote session all shape which approach makes the most practical sense for your situation.