How to find ip address in Linux

How to find ip address in Linux

This article is about knowing how to find IP address of your Linux machine.

Difficulty Level

Difficulty for this job is - easy.

Method 1:

Open up your terminal by hitting ctrl+alt+T (on Ubuntu) or by simply searching in your application menu. Copy the following command and paste it in your terminal then hit Enter


If no arguments are given, ifconfig displays the status of the currently active interfaces. If a single interface argument is given, it displays the status of the given interface only.

Method 2:

Open terminal and type the following command

$hostname -i

This command will Display the network address(es) of the host name. Note that this works only if the host name can be resolved. Option -i, this option depends on name resolution.

If you want to find the IP addresses of all the network ports like ethernet port and wireless LAN then use the below command

$hostname -I
Output 2409:4071:2315:ffd3:1023:e6b:71a8:fdb3 2409:4071:2315:ffd3:3edc:b00a:c093:b563

Capital -I option with hostname will Display all network addresses of the host. This option enumerates all configured addresses on all network interfaces. The loopback interface and IPv6 link-local addresses are omitted. Contrary to option -i, this option does not depend on name resolution.