How to Find the IP Address in Ubuntu

The Network Telemetry Interrogation Vector

To successfully route SSH traffic into a headless Ubuntu server, or to configure an Apache virtual host to serve a specific website, you must possess the exact mathematical network coordinates of the machine. Utilizing the hostname is often insufficient in complex local networks. You must instruct the Linux kernel to interrogate the active physical network interface cards (NICs) and extract the precise IPv4 or IPv6 cryptographic addresses currently assigned to the hardware.

How to Find the IP Address in Ubuntu

The Linux environment provides modern, streamlined command-line utilities to extract this routing data instantly, completely replacing the deprecated `ifconfig` tool from older systems.

1. Open your terminal application or connect to the server via SSH.
2. Method 1: The Local IP Address (The Modern `ip` Command):
* This is the primary protocol for discovering your server’s internal coordinate on a local network (e.g., `192.168.1.50` or `10.0.0.15`).
* Type the following exact command:
ip a (or `ip addr show`)
* Press Enter.
* The terminal will output a dense block of telemetry for every network adapter. You must filter the data visually:
* Ignore the block labelled `lo` (Loopback, which is always `127.0.0.1`).
* Look for the primary physical adapter, usually labelled `eth0` (Ethernet) or `enp3s0` or `wlan0` (Wi-Fi).
* Directly under that specific adapter’s header, locate the line beginning with inet. The numbers immediately following `inet` (before the forward slash, e.g., `192.168.1.104/24`) is your exact Local IP address.
3. Method 2: The Rapid Hostname Interrogation (`hostname -I`):
* If you find the `ip a` output too chaotic and simply want the raw IPv4 address with zero formatting, use the hostname utility.
* Type: hostname -I (Note: That is a capital ‘i’, not a lowercase ‘l’).
* Press Enter.
* The terminal will instantly output a single line containing only the IP address (e.g., `192.168.1.104`).
4. Method 3: The Public IP Address (The External Ping):
* The previous commands only show how your router sees your server. They do not show how the internet sees your server. To find your Public IP, you must bounce a signal off an external server.
* You must use the `curl` command (which downloads data from a URL).
* Type: curl ifconfig.me
* Press Enter.
* The external server will read the origin of the request and print your exact Public IP address directly into your terminal.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.