The commands that show your IP address
The fastest way to find your IP address in Linux is to open a terminal and run ip addr. This command displays all network interfaces on your machine and their assigned addresses. You will see output that lists each interface (like eth0 or wlan0) along with an IPv4 address starting with numbers like 192.168 or 10.0, and possibly an IPv6 address as well.
If ip addr does not work on your system, try hostname -I, which prints only the IP addresses without the extra interface details. This is simpler if you just need the address itself and not the full network configuration.
For older Linux systems that do not have the ip command, use ifconfig. This shows similar information but in a different format — look for the line labeled "inet" under your active network interface to find the IPv4 address.
Key Takeaways
- Run ip addr in a terminal to see all network interfaces and their IP addresses on your Linux machine.
- Use hostname -I if you want only the IP addresses printed without interface names or other details.
- The IPv4 address is the one you typically need for connecting devices or configuring network settings, usually starting with a number like 192.168 or 10.0.
- Your local IP address (the one shown by these commands) is different from your public IP, which is what websites see when you connect to the internet.
Understanding what the output means
When you run ip addr, you will see sections for each network interface. The one you care about is usually labeled eth0 (for wired connections) or wlan0 (for wireless). Look for the line that starts with "inet" — the address right after that word is your IPv4 address on your local network.
You may also see an "inet6" line, which is an IPv6 address. IPv6 is the newer address format and looks like a string of hexadecimal characters separated by colons (for example, fe80::1). Most home networks still use IPv4, but both can coexist on the same machine.
The number after the slash (like /24 in 192.168.1.100/24) is the subnet mask, which tells your computer which other devices are on the same local network. You usually do not need to worry about this number unless you are setting up network configuration manually.
Finding your public IP address from Linux
The commands above show your local IP address — the one your router assigned to your machine. This is different from your public IP address, which is what websites and services on the internet see when you connect to them.
To find your public IP from the Linux terminal, run curl ifconfig.me or curl icanhazip.com. Both commands fetch your public address from an external service and print it to the terminal. You need an internet connection for this to work.
If you do not have curl installed, you can use wget -qO- ifconfig.me instead. The result is a single IP address — that is what the outside world sees when you browse the web or connect to a remote server.
Checking a specific network interface
If your machine has multiple network interfaces and you want to check only one, use ip addr show eth0 (replacing eth0 with the interface name you want). This narrows the output to just that interface, which is useful on servers or machines with many network connections.
You can also use ip -4 addr to show only IPv4 addresses, or ip -6 addr to show only IPv6. This filters out the address type you do not need and makes the output easier to read.
Using graphical tools instead of the terminal
If you prefer not to use the terminal, most Linux desktop environments show your IP address in the network settings. In GNOME (used by Ubuntu and Fedora), click the system menu in the top right, select "Settings," then go to "Network." Your wired or wireless connection will show the IP address assigned to it.
In KDE Plasma, open "System Settings," navigate to "Connections," and click on your active network. The IP address appears under the connection details. The exact steps vary slightly between distributions, but the network settings panel is the standard place to find this information in any graphical Linux desktop.
Why you might need your IP address
Your local IP address is useful for several practical reasons. If you are setting up a printer or smart home device on your network, you may need to enter your computer's IP address. If you are running a web server or application on your machine and want to access it from another device on the same network, you connect to that IP address.
Your public IP address matters when you are troubleshooting internet connection problems, setting up remote access to your machine, or checking whether your internet service provider has assigned you a static or dynamic address. Some services also use your public IP to determine your approximate location or to block access from certain regions.
Frequently Asked Questions
Why do I see multiple IP addresses when I run ip addr?
Each network interface gets its own IP address. If your machine has both a wired connection (eth0) and wireless connection (wlan0), each will have a separate address. The loopback interface (lo) also appears with the address 127.0.0.1, which is used for local testing and is not a real network address.
Is my local IP address the same as my public IP?
No. Your local IP (like 192.168.1.100) is assigned by your router and only works on your home or office network. Your public IP is assigned by your internet service provider and is what the outside internet sees. They are different addresses for different purposes.
Can I change my IP address in Linux?
Yes, but it depends on whether you want to change your local or public address. Local addresses are usually assigned automatically by your router's DHCP server, but you can configure a static address manually in your network settings. Your public IP is controlled by your internet service provider and cannot be changed directly from your machine.
What if ip addr does not show any address?
This usually means your network interface is not connected or not configured. Check that your ethernet cable is plugged in or your wireless network is connected. You can also run ip link to see the status of each interface — look for "UP" to confirm it is active.
Do I need to be root to see my IP address?
No. Regular users can run ip addr, hostname -I, and ifconfig without administrator privileges. You only need root access if you want to change network settings or configure a static IP address.