The fastest way to see your IP address in Linux

The quickest command to see your IP address in 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, and your IP address appears 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 shows just the IP addresses assigned to your machine, one per line. Both commands work on any Linux distribution — Ubuntu, Debian, Fedora, CentOS, or others.

The older command ifconfig still works on many systems, but Linux distributions are moving away from it. If you type ifconfig and nothing happens, your system does not have it installed, and you should use ip addr show instead.

Key Takeaways

  • Type ip addr show in a terminal to see all your network connections and their IP addresses.
  • Use hostname -I to see only the IP addresses without extra network details.
  • Your IPv4 address appears next to "inet" and your IPv6 address next to "inet6" in the output.
  • The older ifconfig command still works on some systems but is no longer the standard in modern Linux.
  • You do not need administrator permissions to view your own IP address with these commands.

Understanding the output from ip addr show

When you run ip addr show, the output looks confusing at first because it lists every network interface on your machine. Each interface starts with a number and a name — lo is your loopback interface (used only by your machine to talk to itself), and eth0, wlan0, or enp0s3 are your actual network connections.

Look for the line that starts with "inet" under the interface you are using. That line shows your IP address followed by a slash and a number. For example, inet 192.168.1.50/24 means your IP address is 192.168.1.50. The 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 multiple interfaces with inet addresses, the one you are using depends on how you are connected. If you are on Wi-Fi, look under the wireless interface (usually wlan0). If you are plugged in with an Ethernet cable, look under the wired interface (usually eth0 or enp followed by numbers).

Finding your IP address on a specific network interface

If you know which network interface you want to check, you can look at just that one instead of seeing everything. Type ip addr show eth0 to see only the Ethernet interface, or ip addr show wlan0 for Wi-Fi. Replace the interface name with whichever one you want to check.

This is useful when your machine has multiple network connections and you need to know which IP address goes with which one. For example, a server might be connected to both a public network and a private network, and you need to know which address to give to someone trying to reach it.

Checking your public IP address from the command line

The commands above show your local IP address — the one your router assigned to your machine on your home or office network. Your public IP address is different; it is the address that the rest of the internet sees when you connect to websites.

To see your public IP address from the terminal, use a command like curl ifconfig.me or wget -qO- http://icanhazip.com. These commands contact a website that tells you what IP address you are connecting from. You need an internet connection for this to work.

If curl is not installed on your system, try wget instead. If neither works, you can always open a web browser and search "what is my IP address" — any search engine will show it to you at the top of the results.

Using grep to find just your IP address

If you want to see only your IP address without any other information, you can combine ip addr show with a filter. Type ip addr show | grep "inet " | grep -v "127.0.0.1" and press Enter. This shows only the lines with IP addresses and removes the loopback address (127.0.0.1), which is not useful for connecting to other machines.

This command uses pipes (the | symbol) to send the output of one command into another. The first grep finds lines containing "inet", and the second grep removes the loopback address. The result is a clean list of your actual IP addresses.

You do not need to memorize this command. If you only need your IP address once, hostname -I is simpler. But if you find yourself checking it often, you can save this command or create a shortcut for it.

Checking IP address on systems without ip command

Older Linux systems or minimal installations might not have the ip command available. In that case, try ifconfig first. If that does not work, use cat /proc/net/route to see your network configuration, though the output is harder to read.

Another option is nmcli device show if your system uses NetworkManager to handle connections. This shows detailed information about all network devices, including their IP addresses. Type nmcli device show | grep IP4.ADDRESS to see only the IPv4 addresses.

If you are working on a very minimal system and none of these commands work, you can check the configuration files directly. Look in /etc/network/interfaces (on Debian-based systems) or /etc/sysconfig/network-scripts/ (on Red Hat-based systems), though these files show the configuration rather than the current address.

Viewing IP address information in a graphical interface

If you prefer not to use the terminal, most Linux desktop environments show your IP address in the network settings. Click the network icon in your system tray (usually in the top right or bottom right corner), then look for "Connection Information" or "Network Settings". The IP address appears there alongside other connection details.

In Ubuntu with GNOME, click the system menu in the top right, then click the Wi-Fi or network icon, then click the gear icon next to your connection name. In other desktop environments like KDE or Cinnamon, the location varies, but network settings are always available through the system menu.

The graphical method is slower than typing a command, but it is useful if you are not comfortable with the terminal or if you need to see other network information at the same time, like your gateway address or DNS servers.

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 on your home or office network. Your public IP is assigned by your internet service provider and is what websites see when you connect to them. Local IPs usually start with 192.168 or 10, while public IPs can be any address.

Why do I see multiple IP addresses when I run ip addr show?

You see multiple addresses because your machine has multiple network interfaces. The loopback interface (lo) always shows 127.0.0.1, and each physical or virtual network connection shows its own address. You only need the address from the interface you are actually using.

Can I change my IP address from the command line?

Yes, but it requires administrator permissions and depends on your network setup. Use sudo ip addr add 192.168.1.100/24 dev eth0 to add an address or sudo ip addr del 192.168.1.50/24 dev eth0 to remove one. Changes made this way are temporary and reset when you reboot.

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 bits of the address identify the network and how many identify individual machines. For most home networks, /24 is standard. You do not need to change it unless you are setting up a custom network.

Why does my IP address sometimes change?

Your router assigns IP addresses dynamically using DHCP, which means the address can change when you reconnect or when your lease expires. If you need a permanent address, you can set a static IP in your router settings or configure it manually on your machine, though this requires administrator access.