The fastest way to see your IP address in Linux
The quickest command to view your IP address in Linux is ip addr show. Open a terminal window and type that command, then press Enter. You will see a list of all network connections on your computer, with your IP address displayed next to "inet" for IPv4 or "inet6" for IPv6.
If you only want to see the IP address without all the extra information, use hostname -I. This command prints just your IP address or addresses on a single line, which is useful when you need the number quickly without scrolling through details.
Both commands work on any modern Linux system — Ubuntu, Debian, Fedora, CentOS, and others. You do not need administrator permission to run either one, though some older systems may require sudo at the start if your user account has limited permissions.
Key Takeaways
- The ip addr show command displays all your network connections and their IP addresses in one output.
- The hostname -I command shows only your IP address on a single line, with no extra details.
- Your IPv4 address appears next to "inet" and your IPv6 address appears next to "inet6" in the full output.
- Both commands work without administrator permission on standard Linux systems.
- If you are connected to multiple networks, you will see a separate IP address for each one.
Understanding what you see in the output
When you run ip addr show, the output is organized by network interface. Each interface has a name like "eth0", "wlan0", or "lo". The "lo" interface is your local loopback — it always shows 127.0.0.1 and is not a real network connection. Look for the interface that matches how you are connected: "eth0" or "enp" names are usually wired connections, and "wlan0" or "wlp" names are usually wireless.
Next to "inet" you will see your IPv4 address followed by a slash and a number like "/24". That number is your subnet mask in a different format. Next to "inet6" you will see a longer address made of letters and numbers — that is your IPv6 address, which is the newer version of IP addressing. Most home networks use IPv4, but both may be present on your system.
If you see "inet 127.0.0.1" or no inet line at all for a network interface, that interface is not currently connected to a network. Check that your cable is plugged in or your wireless connection is active.
Other commands that show your IP address
The ifconfig command is older but still works on most Linux systems. Type ifconfig and press Enter to see output similar to ip addr show. Look for "inet addr:" or just "inet" to find your IP address. This command is less common on newer systems because ip has replaced it, but you may encounter it in older documentation or on servers that have not been updated recently.
The nmcli command works if your system uses NetworkManager, which is common on desktop Linux. Type nmcli device show to see detailed connection information, or nmcli connection show to see saved networks. This command is more verbose than the others but can be useful if you need to troubleshoot connection problems.
For a single specific interface, you can type ip addr show eth0 (replacing "eth0" with your interface name). This shows only that one connection instead of all of them, which is helpful if your system has many network interfaces and you want to focus on one.
Finding your IP address if you are using a graphical desktop
If you prefer not to use the terminal, most Linux desktop environments have a network settings window. On Ubuntu with GNOME, click the network icon in the top right corner, then click the gear icon or "Settings". Look for "Wired" or "Wi-Fi" depending on how you are connected, then click the connection name to see its details. Your IP address will be listed under "IPv4 Address" or "IPv6 Address".
On other desktops like KDE Plasma or Cinnamon, the location varies, but the process is similar: open Settings or System Settings, find the Network section, and click on your active connection. The IP address is usually displayed prominently on the connection details page.
The graphical method is slower than typing a command, but it shows the same information and does not require you to remember command names. If you work in the terminal regularly, learning the commands is worth the time investment.
Why you might need to know your IP address
Your IP address is how other computers on your network find and communicate with yours. If you are setting up a printer, a file server, or remote access to your computer, you will need to give someone or something your IP address. It is also useful for troubleshooting network problems — if your internet is not working, knowing your IP address helps you determine whether your computer is connected to the network at all.
The address you see from ip addr show is your local IP address — the one other computers on your home or office network use to reach you. This is different from your public IP address, which is what websites see when you visit them. Your local IP usually starts with 192.168, 10.0, or 172.16, while your public IP is assigned by your internet provider.
What to do if you do not see an IP address
If ip addr show runs but you see no inet line for your network interface, your computer is not connected to a network. Check that your ethernet cable is plugged in or your wireless connection is turned on and connected to a network. Then run the command again.
If the command itself does not work or you get a "command not found" error, your system may be very old or minimal. Try ifconfig instead. If that also fails, you may be in a restricted environment like a container or virtual machine with limited tools. Contact your system administrator for help.
If you see an IP address but cannot reach other computers or the internet, the problem is not with finding your address — it is with your network connection itself. That requires different troubleshooting steps beyond viewing the address.
Frequently Asked Questions
What is the difference between my local IP and my public IP?
Your local IP is assigned by your router and is used only within your home or office network. Your public IP is assigned by your internet provider and is what websites see. The ip addr show command shows your local IP. To find your public IP, you would need to visit a website like whatismyipaddress.com or use a command like curl ifconfig.me.
Why do I see multiple IP addresses?
If your computer has multiple network interfaces — for example, both ethernet and wireless — each one gets its own IP address. You may also see a loopback address (127.0.0.1), which is not a real network connection. Only the addresses on interfaces you are actually using matter for communicating with other computers.
Can I change my IP address in Linux?
Yes, but how depends on your setup. If your router assigns addresses automatically (DHCP), you can usually request a new one by disconnecting and reconnecting. To set a static IP address that does not change, you need to edit your network configuration files, which requires administrator permission and varies by Linux distribution.
Is it safe to share my local IP address?
Your local IP is only useful to devices already on your network, so sharing it with someone outside your home or office does not expose you to internet-wide risks. However, do not share it with people you do not trust on your local network, since they could use it to target your computer directly.
Do I need to be root or use sudo to view my IP address?
No. Both ip addr show and hostname -I work for regular users without administrator permission. If you get a "permission denied" error, your user account has unusual restrictions, and you should contact your system administrator.