Maintaining a reliable network connection starts with knowing your machine’s identity.
Checking your IP address in Linux allows you to verify connectivity, configure remote access, and troubleshoot service interruptions. This guide explains four practical methods to reveal both your internal and external IP addresses.
You can use these commands across all major distributions, including Red Hat Enterprise Linux, Ubuntu, and Debian.
Table of Contents
Key Takeaways: How to Check IP Address in Linux
ip addrcommand → The current modern standard for Linux network administration, replacing the legacyifconfigtool.hostname -Icommand → The most efficient choice for a quick summary. It returns only the numeric IP values assigned to the host.nmclicommand → The primary tool for systems managed by NetworkManager. It provides a high-level view of device status and is essential for managing complex connections and connecting to Wi-Fi from the terminal.curl ifconfig.me→ A simple method to find your public IP address. While other commands show your internal identity, this queries an external service to reveal how the global internet sees your network gateway.
Method 1: Using the ip Command
The ip addr command is the modern standard for network administration and has largely replaced the legacy ifconfig tool. It provides a comprehensive view of all network interfaces.
Run this command for a detailed report: ip addr
The output will display several blocks of information. Look for the line starting with inet; the four-part number following it is your IPv4 address.
For example, in a cloud environment, you might see a private address like 192.0.2.1 assigned to your primary interface. For a more focused view, you can specify an interface: ip addr show eth0
Method 2: Applying the hostname Command
If you need a quick, no-frills summary of your machine’s IP addresses, the hostname command is the most efficient choice.
Use this syntax for a concise list: hostname -I
This command returns only the IP addresses assigned to the host, stripped of all technical metadata. It is particularly useful for find IP address with shell script tasks where you only need the numeric values. Unlike the ip command, this method does not list the loopback address (127.0.0.1) unless it is the only one available.
See also: Mastering the Linux Command Line — Your Complete Free Training Guide
Method 3: Employing the nmcli Tool
On modern systems that use NetworkManager, the nmcli (Network Manager Command Line Interface) tool provides a high-level view of your connections. This is the go-to tool for managing nmcli connect to Wi-Fi scenarios.
Run this command to see device status and IPs: nmcli device show
This tool is invaluable for administrators who need to manage complex configurations or virtual interfaces. If you are choosing between tools, you can read more on the ip command or nmcli debate here.
Method 4: Finding Your Public IP with curl
The previous methods show your internal network identity. To find your public IP address—the one the rest of the internet sees—you can use the curl command to query an external service.
Run this command to see your public address: curl ifconfig.me
This is essential for setting up remote access via SSH or verifying if your traffic is correctly routing through a gateway. It bypasses local interface configurations to tell you exactly how your network gateway identifies your machine to the outside world.
Understanding Network Interfaces
When reviewing your IP information, you will encounter standard interface names:
- lo: The loopback interface (always
127.0.0.1), used for the machine to talk to itself. - eth0 or enp3s0: Typically your primary wired Ethernet connection.
- wlan0: Your primary wireless Wi-Fi connection.
Most connectivity issues stem from an interface being “DOWN.” Always check the status line in your ip addr output to ensure the interface is “UP” before troubleshooting anything else.
Step-by-Step Process for checking ip address in Linux
- Launch your terminal application.
- Type
ip addrto see all active connections. - Identify your active interface (look for the “UP” status).
- Locate the
inetline to find your local IPv4 address. - Use
curl ifconfig.meif you specifically need your public identity for remote configurations.
Practical Tips
- IPv4 Only: Use
ip -4 addrto filter out IPv6 addresses if they make the output difficult to read. - Check Link Status: If you don’t see an IP, run
ip linkto see if the hardware interface is even recognized. - Troubleshooting: If you receive a “command not found” error, remember that many new systems no longer include
ifconfigby default.
Summary Table
| Task | Recommended Command | Best Used For… |
|---|---|---|
| Complete Audit | ip addr | Viewing all details, including MAC and IPv6. |
| Quick Summary | hostname -I | Getting just the numbers for scripts or copy-pasting. |
| Device Management | nmcli device show | Troubleshooting Wi-Fi and managed connections. |
| Public Identity | curl ifconfig.me | Finding your external IP on the internet. |
| Specific Interface | ip addr show <name> | Focused troubleshooting on one network card. |
FAQs
What is the quickest way to check my IP address in Linux? Typing hostname -I provides an immediate list of your assigned IP addresses without any technical clutter.
Why do I see 127.0.0.1? This is the loopback address. It allows your computer to communicate with its own internal services and is present on every Linux system.
How do I find my IP if ifconfig is missing? Modern Linux versions have deprecated ifconfig. You should use the ip addr command, which is the standard in RHEL 10 and recent Ubuntu releases.
Does my IP change when I reboot? It depends on whether your system uses a static IP or DHCP. Most home and cloud instances use DHCP, meaning your IP might change periodically.
Related Guides



