The fastest way to check your IP address in Linux
The quickest command to see 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 machine, with your IP address displayed next to "inet" for IPv4 or "inet6" for IPv6.
If you want only your active internet connection without the extra details, use hostname -I instead. This shows just the IP addresses assigned to your machine, one per line. Both commands work on any Linux distribution — Ubuntu, Fedora, Debian, CentOS, and others.
The older command ifconfig still works on many systems, but Linux distributions are moving away from it. If you learn ip addr show now, you will have the command that works everywhere.
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 without the extra network information.
- Your IP address appears next to "inet" for IPv4 (the standard format like 192.168.1.5) or "inet6" for the newer IPv6 format.
- These commands work the same way on Ubuntu, Fedora, Debian, CentOS, and other Linux distributions.
Understanding what the output shows you
When you run ip addr show, the output groups information by network interface. Each interface is labeled with a number and name — lo is your local loopback (used only by your machine talking to itself), and eth0, wlan0, or enp0s3 are your actual network connections. The name depends on your hardware and Linux version.
Under each interface, you will see several lines. The line starting with "inet" contains your IPv4 address — the one you usually need. It looks like four numbers separated by dots, such as 192.168.1.100 or 10.0.0.50. The number after the slash (like /24) is the subnet mask, which tells your machine which other addresses are on the same local network.
If you see multiple interfaces with inet addresses, you have multiple network connections. A laptop might show both a wired connection (eth0) and a wireless connection (wlan0), for example. Only the ones that are actually connected will have an inet address listed.
Finding your public IP address versus your local IP address
The IP address shown by ip addr show is your local IP address — the one your router assigned to your machine on your home or office network. This is different from your public IP address, which is what websites see when you connect to them. Your router hides your local IP from the internet.
To find your public IP address from Linux, you need to ask an outside service. The command curl ifconfig.me will show your public IP. If that does not work, try curl icanhazip.com or wget -qO- https://checkip.amazonaws.com. These commands fetch your public IP from a web service and display it in the terminal.
For most everyday tasks — connecting to your printer, accessing files on another computer at home, or troubleshooting your network — you need your local IP address. You only need your public IP if you are setting up remote access or troubleshooting why a website is blocking you.
Checking the IP address of a specific network interface
If you have multiple network connections and want to see only one, you can specify which interface to check. Type ip addr show eth0 to see only the eth0 interface, or replace eth0 with whatever your interface is named. This is useful when you have both wired and wireless connections and need to know which one is active.
You can also use ip link show to see which interfaces exist and whether they are up (connected) or down (disconnected). This tells you which interfaces are available before you check their IP addresses. The output shows "UP" or "DOWN" next to each interface name.
If you are troubleshooting a connection problem, checking both ip link show (to see if the interface is connected) and ip addr show (to see if it has an IP address) will tell you whether the problem is a hardware connection or a network configuration issue.
Using graphical tools if you prefer not to use the terminal
Most Linux desktop environments include a network settings application where you can view your IP address without typing commands. In Ubuntu with GNOME, click the network icon in the top right corner, select "Wired Connected" or your wireless network name, then click the settings gear icon. A window opens showing your IP address and other network details.
In KDE Plasma, open System Settings and go to Connections. You will see all your network interfaces listed with their IP addresses. In other desktop environments, look for a Network Settings or Network Manager application in your application menu.
The graphical approach is slower if you need to check your IP address repeatedly, but it is useful if you are not comfortable with the terminal. The information shown is the same — you are just viewing it through a different interface.
Saving your IP address or checking it automatically
If you need to check your IP address regularly, you can create a simple script. Open a text editor and type the command you want to run — for example, ip addr show | grep "inet " | grep -v 127.0.0.1. This filters the output to show only IPv4 addresses that are not the loopback address. Save the file as check-ip.sh, then make it executable by typing chmod +x check-ip.sh in the terminal. After that, you can run it anytime by typing ./check-ip.sh.
If your IP address changes frequently and you need to track it, you can set up a cron job to run a command at regular intervals and log the results. This is more advanced, but it is useful if you are running a server or need to monitor network changes over time.
For most users, simply running ip addr show or hostname -I when you need your IP address is the most practical approach. Both commands are fast and show you exactly what you need.
Frequently Asked Questions
Why do I see multiple IP addresses when I run ip addr show?
You are seeing one address per network interface. If you have a wired connection and a wireless connection, each one gets its own IP address. The loopback interface (lo) always has 127.0.0.1, which is used only for your machine to talk to itself. You only need the address from the interface you are actually using.
What does the number after the slash mean in an IP address?
That number is the subnet mask in CIDR notation. It tells your machine how many devices are on the same local network as you. For home networks, /24 is standard and means you can reach any address from 192.168.1.0 to 192.168.1.255 (if your IP starts with 192.168.1). You usually do not need to change or understand this number unless you are setting up a network.
Can I change my IP address in Linux?
Yes, but it depends on whether you want to change your local IP (assigned by your router) or your public IP (assigned by your internet provider). Changing your local IP requires editing your network configuration files or using your router's settings. Changing your public IP usually means restarting your modem or contacting your internet provider. Most users do not need to change their IP address.
What if hostname -I shows nothing or an error?
This usually means your network interface is not connected or does not have an IP address assigned. Run ip link show to see if your interface is up. If it shows "DOWN", your connection is disconnected. If it shows "UP" but has no IP address, your network may not be configured correctly. Try restarting your network with sudo systemctl restart networking or reconnecting to your wireless network.
Is there a way to see my IP address without opening a terminal?
Yes. Most Linux desktop environments have a network settings application accessible from the system menu or settings. Click the network icon in your taskbar or panel, look for a settings or information option, and your IP address will be displayed there. The exact steps vary by desktop environment, but the network settings are always available through the graphical interface.