When configuring a firewall, setting up a local web server, or attempting to SSH into a headless machine on your network, you absolutely must know your system’s IP address. While older tutorials often rely on the deprecated ifconfig utility, modern Linux distributions have replaced it entirely with the much more powerful and versatile ip command suite.
Finding your local IP address using the modern command structure takes less than a second.
How to Find Your Local IP Address
The ip command does not require root (sudo) privileges to simply view network data.
- Open your terminal emulator.
- Execute the following exact command:
ip a
- Press Enter.
The terminal will print a block of text detailing every network interface physically connected to your machine.
How to Read the Output
The output might look overwhelming at first glance, but you only need to locate two specific pieces of information.
- Identify your active interface: Look for the primary connection to your router. If your computer is hardwired with an Ethernet cable, the interface will usually be named something starting with
ethorenp(e.g.,enp3s0). If you are connected via Wi-Fi, the interface will likely start withwlanorwlp(e.g.,wlp2s0). - Ignore the loopback: You will always see an interface named
lo(loopback). This is simply the computer talking to itself, and its IP address will always be127.0.0.1. You can ignore this entirely. - Find the inet line: Once you locate your active ethernet or Wi-Fi block, look for the line that begins with the word inet.
Directly following the word inet, you will see your local IP address, usually formatted as something similar to 192.168.1.15/24 or 10.0.0.52/24.
The numbers before the forward slash (192.168.1.15) represent the actual IP address assigned to your Linux machine by your home router. The /24 simply represents the subnet mask.
A Cleaner Alternative Output
If the standard ip a output is too dense, you can force the command to print a highly simplified, color-coded summary by using the brief flag:
ip -c -br a
This command prints a perfectly formatted table displaying only the interface name, its status (UP or DOWN), and the associated IP address, making it incredibly easy to read at a glance.