how to check ip address in ubuntu linux

Checking your IP address in Ubuntu can be done quickly using several built-in terminal commands. Below are the primary methods:

1. Using the ip Command (Most Common)

The standard way to identify all available network interfaces and their associated IP addresses is by using the ip command from the iproute2 suite.

  • Command: ip addr
  • Expected Output: This command displays detailed information for every interface. Look for the line starting with inet (for IPv4) or inet6 (for IPv6). For example, an active Ethernet interface might show: inet 10.102.66.200/24 brd 10.102.66.255 scope global dynamic eth0.

For a more concise summary, you can use the “brief” flag:

  • Command: ip -4 -brief address show
  • Expected Output: This provides a clean table showing the interface name, status, and IPv4 address (e.g., ibmveth2 UNKNOWN 10.245.246.42/24).

2. Using Netplan

On modern Ubuntu systems, you can use Netplan to get a high-level overview of your network interfaces and correlated information, such as default routes and DNS addresses.

  • Command: sudo netplan status -a
  • Expected Output: This lists active interfaces and their addresses in an easy-to-read format: Addresses: 10.102.66.200/24 (dynamic, dhcp).

3. Using landscape-sysinfo

If you want a quick snapshot of system health along with your network identity, the landscape-sysinfo tool provides this data.

  • Command: landscape-sysinfo
  • Expected Output: Among other stats like system load and memory usage, it explicitly lists your IP addresses: IPv4 address for enp5s0: 10.185.198.41.

Summary Table: IP Check Commands

CommandBest Use Case
ip addrDetailed view of all interfaces and parameters.
ip -4 -brief address showQuick, readable summary of IPv4 addresses.
sudo netplan status -aComprehensive overview of interfaces and routes.
landscape-sysinfoSnapshot of IP addresses along with system performance.

Tip: When managing remote servers, always verify your IP address before making persistent configuration changes to avoid losing access to your system.

David Cao
David Cao

David is a Cloud & DevOps Enthusiast. He has years of experience as a Linux engineer. He had working experience in AMD, EMC. He likes Linux, Python, bash, and more. He is a technical blogger and a Software Engineer. He enjoys sharing his learning and contributing to open-source.

Articles: 640

Leave a Reply

Your email address will not be published. Required fields are marked *