The fastest way to find your IP address on Linux
The quickest command to see your IP address on Linux is ip addr show. Open a terminal and type that command, then press Enter. You will see a list of all network connections on your machine, with your IP address next to "inet" for IPv4 or "inet6" for IPv6.
If you only want to see the IP address without extra information, use hostname -I. This prints just the addresses, one per line, which is useful when you need the number quickly or want to copy it into another program.
Both commands work on any modern Linux system — Ubuntu, Fedora, Debian, CentOS, and others. You do not need administrator access to run them, though some older systems may require sudo in front of the command if you get a permission error.
Key Takeaways
- Type ip addr show in a terminal to see all your network connections and their IP addresses.
- Use hostname -I if you want only the IP addresses printed without extra details.
- The address next to "inet" is your IPv4 address; "inet6" is your IPv6 address.
- Both commands work without administrator access on most Linux systems.
- If you are connected to multiple networks, you will see multiple IP addresses — one per connection.
Understanding what the output shows you
When you run ip addr show, the output is organized by network interface. Each interface starts with a number (like 1, 2, 3) and a name (like "lo", "eth0", or "wlan0"). The "lo" interface is your local loopback — it is not a real network connection, so ignore it.
The real network connections are usually named "eth0" or "enp0s3" for wired connections and "wlan0" or "wlp2s0" for wireless. Next to each one, you will see "inet" followed by an IP address and a slash with a number (like 192.168.1.100/24). That number after the slash is the subnet mask in a different format — you do not need to worry about it for most purposes.
If you see "inet" with no address next to it, that interface is not currently connected. If you see multiple "inet" lines under one interface, that interface has been assigned multiple IP addresses, which is uncommon but possible.
Using ifconfig if ip addr does not work
On older Linux systems, the ip command may not be installed. If you type ip addr show and get "command not found", try ifconfig instead. This is an older tool that does the same job.
With ifconfig, your IP address appears next to "inet addr:" on each network interface. The layout is different from ip addr show, but the information is the same — look for the line that says "inet addr:" and the number after it is your IP address.
If ifconfig also does not work, your system may not have either tool installed. In that case, contact your system administrator or the person who set up your Linux machine, because the tools needed to check network settings are missing.
Finding your IP address through the graphical interface
If you prefer not to use the terminal, most Linux desktop environments have a network settings window. On Ubuntu with GNOME, click the system menu in the top right corner (usually three horizontal lines or a gear icon), then look for "Settings" or "Network Settings". Click on your active connection, and your IP address will be displayed.
On other desktop environments like KDE or Cinnamon, the location varies, but the principle is the same — find the network or settings icon, open network settings, and click on your active connection. The IP address is usually shown in a details or information section.
The graphical method is slower than typing a command, but it shows the same information and does not require you to remember the command name.
Checking a specific network interface
If you have multiple network connections and only want to see the IP address for one of them, you can specify the interface name. For example, ip addr show eth0 shows only the eth0 interface, and ip addr show wlan0 shows only the wireless interface.
This is useful when you have both wired and wireless connections active and you need to know which one you are currently using. Run ip addr show first to see all your interface names, then use the specific command for the one you care about.
You can also use ip route to see which interface is your default route — the one your computer uses for most traffic. The line that says "default via" shows which interface handles your main network connection.
Finding your public IP address from Linux
The commands above show your local IP address — the one your computer uses on your home or office network. If you need your public IP address — the one the internet sees when you connect to websites — you have to ask an external service.
The simplest way is to open a terminal and type curl ifconfig.me. This connects to a website that tells you your public IP address and prints it to the terminal. Other similar commands are curl icanhazip.com or curl ident.me — they all do the same thing.
These commands only work if your computer has internet access. If you are on a network without internet, they will time out or fail. Your local IP address (from ip addr show) is what you need in that case.
Saving your IP address to a file
If you need to save your IP address for later use, you can redirect the output to a file. Type ip addr show > my_ip.txt and the full output will be saved to a file called "my_ip.txt" in your current directory. You can then open that file in any text editor.
If you only want to save the address itself without all the extra information, use hostname -I > my_ip.txt instead. This creates a file with just the IP addresses, one per line.
You can also copy the output directly from the terminal by selecting the text with your mouse and pressing Ctrl+C, then pasting it into any document or email with Ctrl+V.
Frequently Asked Questions
Why do I see multiple IP addresses when I run the command?
You are likely connected to multiple networks at the same time — for example, both wired ethernet and wireless. Each connection gets its own IP address. If you only want one, check which interface you are actually using with ip route, which shows your default connection.
What is the difference between 127.0.0.1 and my actual IP address?
127.0.0.1 is your loopback address — it points back to your own computer and is not a real network connection. Your actual IP address is the one on your real network interface (eth0, wlan0, etc.), usually starting with 192.168 or 10.
Can I change my IP address from the terminal?
Yes, but it requires administrator access and knowledge of your network setup. Use sudo nano /etc/netplan/01-netcfg.yaml on Ubuntu or edit the appropriate network configuration file for your system. Most users should not change this without understanding their network first.
Why does my IP address start with 169.254?
That range means your computer could not reach a DHCP server to get a normal IP address. Check that your network cable is plugged in or that you are connected to the correct wireless network. Restart your network connection and try again.
Is my local IP address private or public?
Your local IP address is private — it only works on your home or office network. Addresses starting with 192.168, 10, or 172.16 are always private. To find your public IP address (what the internet sees), use curl ifconfig.me.