The fastest way to check your IP address on Linux

The quickest command is hostname -I, which displays all IP addresses assigned to your machine in a single line. Open a terminal and type that command, then press Enter. You will see your local IP address (usually starting with 192.168 or 10.) and possibly your public IP if you are on a network that assigns one directly.

If you need only your public IP — the address the outside internet sees — use curl ifconfig.me or wget -qO- ifconfig.me. These commands contact an external service and return your public-facing address. The curl version is simpler if curl is installed on your system.

For a more detailed view that shows network interfaces, their IP addresses, and connection status all at once, use ip addr show. This command lists every network device on your machine along with its assigned addresses, which is useful if you have multiple network cards or virtual interfaces.

Key Takeaways

  • Use hostname -I to see your local IP address immediately in your terminal.
  • Use curl ifconfig.me to find your public IP address — the one visible to the internet.
  • Use ip addr show to see all network interfaces and their addresses in one detailed output.
  • The ifconfig command still works on older Linux systems but is deprecated on newer ones in favor of ip.
  • Your local IP address typically starts with 192.168 or 10., while your public IP is assigned by your internet service provider.

Understanding local versus public IP addresses

Your machine has two different IP addresses. Your local IP address (or private IP) is used only within your home or office network — it is how your router and other devices on the same network find you. Your public IP address is assigned by your internet service provider and is how servers on the internet identify your connection.

When you use hostname -I or ip addr show, you are seeing your local address. When you use curl ifconfig.me, you are seeing your public address. Most of the time you need your local address — for example, to connect to your Linux machine from another device on your network, or to set up a local server. You need your public address only when you are troubleshooting internet connectivity or setting up remote access from outside your network.

Using the ip command for detailed network information

The ip command is the modern standard on Linux systems and replaces the older ifconfig tool. Type ip addr or ip addr show to see all network interfaces. The output shows each interface name (like eth0, wlan0, or lo), its status (UP or DOWN), and all IP addresses assigned to it.

Each interface listing includes the address in CIDR notation — for example, 192.168.1.100/24. The number after the slash (called the subnet mask) tells your system which part of the address identifies your local network. For most home networks, /24 is standard. You can also use ip link show to see only the interface names and status without addresses, or ip route show to see how your machine routes traffic to different networks.

Checking IP address with ifconfig on older systems

On older Linux distributions, ifconfig is the traditional command for viewing network configuration. Type ifconfig alone to see all active interfaces, or ifconfig eth0 to see details for a specific interface (replace eth0 with your interface name). The output shows the IP address in the line labeled "inet addr" or just "inet".

Most modern Linux systems have removed ifconfig in favor of the ip command, but it may still be available if you install the net-tools package. If you type ifconfig and see "command not found", your system uses the newer ip command instead. There is no practical reason to install ifconfig on a new system — the ip command does everything ifconfig does and more.

Finding your IP address through the graphical interface

If you prefer not to use the terminal, most Linux desktop environments provide a graphical way to check your IP address. In GNOME (used by Ubuntu and Fedora), click the system menu in the top-right corner, select Settings, then go to Network. You will see your connection type and your local IP address listed there.

In KDE Plasma, open System Settings, navigate to Connections, and select your active network. The IP address appears in the connection details. In other desktop environments, look for a Network Settings or Network Manager application in your system menu. The graphical method shows your local IP address but not your public IP — you still need the terminal command for that.

Checking IP address for a specific network interface

If your machine has multiple network connections — for example, both Ethernet and Wi-Fi — you may need to check the address for one specific interface. Use ip addr show eth0 (replacing eth0 with your interface name) to see only that interface. Common interface names are eth0 or enp0s3 for Ethernet, wlan0 or wlp3s0 for Wi-Fi, and lo for the local loopback interface.

To find all available interface names without seeing their addresses, use ip link show. This lists every interface on your system with its status. Once you know the name, you can check its specific address with ip addr show [interface-name]. This is useful when troubleshooting network problems or when you need to configure a specific connection.

Frequently Asked Questions

What is the difference between 127.0.0.1 and my actual IP address?

127.0.0.1 is the loopback address — it points to your own machine and is used only for local testing. Your actual local IP address (like 192.168.1.100) is how other devices on your network reach you. The loopback address appears in the output of ip addr show as the lo (loopback) interface, but you should ignore it for network communication.

Why does my IP address keep changing?

Your local IP address changes when your router reassigns it, which happens when you restart your machine or your router restarts. Your public IP address changes when your internet service provider reassigns it, which can happen daily or weekly depending on your service plan. If you need a stable address for a server or remote access, you can set a static IP in your router settings or configure it directly in Linux.

How do I find the IP address of another Linux machine on my network?

Use arp -a to see all machines your computer has recently communicated with and their IP addresses. You can also use nmap -sn 192.168.1.0/24 (replacing the network range with your own) to scan your local network and list all active devices. The nmap tool may need to be installed separately on your system.

Can I set a permanent IP address on Linux?

Yes. On systems using netplan (Ubuntu 18.04 and newer), edit the configuration file in /etc/netplan/ and set a static IP address there. On systems using NetworkManager or traditional network configuration, you can set a static address in the network settings or by editing /etc/network/interfaces. The exact method depends on your Linux distribution and network manager.

What if hostname -I returns nothing?

This usually means your network interface is not connected or not configured. Use ip link show to check if your interface is UP. If it shows DOWN, your connection is disconnected. If it shows UP but hostname -I returns nothing, your interface may not have been assigned an IP address yet. Try restarting your network with sudo systemctl restart networking or reconnecting to your Wi-Fi.