How to Find IP Address in Linux

Knowing your IP address is essential if you are stuck in any network issue, configuring a firewall, or setting up a new network connection. IP address or the Internet Protocol address comprises a set of numeric digits required for identifying a device and enabling it for communication over the network. Furthermore, an IP address is also used to observe a device’s location.

Don’t know to find out the IP address in Linux? No worries! This post will demonstrate how you can find your IP address using Linux commands and the GUI method. Moreover, the procedure of checking your public IP address will also be provided to you. So, let’s start!

How to find your IP Address in Linux using ip command

In Linux, the “ip” command exists in the net-tools package that can be utilized for conducting various administration tasks. The “Internet Protocol” is abbreviated as “IP“. This command is used to list IP addresses, set up the tunnel over IP, assign, remove, and set up IP addresses and routes, and configure and update default and static routing.

The syntax of the ip command is as follow:

$ ip [Options]

With the “-address” option, you can execute the “ip” command for listing the ip addresses associated with your network devices in this way:

$ ip addr

Here, we can find the IP address of our “enpos3” network device, which is “192.168.43.192”:

How to find your IP Address in Linux using hostname command

In a Linux system, the main function of the “hostname” command is to set or show the hostname and Domain Name Service (DNS) of a system. However, you can also utilize it to find the ip address of your Linux system. Before doing so, check out the below-given syntax of the “hostname” command:

$ hostname [Options]

Now, to find your IP address in a Linux-based system, write out the “hostname” command with the “-I” option in your terminal:

$ hostname -I

How to find your IP Address in Linux using ifconfig command

ifconfig” is a network or system administration tool that permits you to manage, configure, and examine different network interface parameters using configuration scripts and terminals.

To use “ifconfig” command, firstly, you need to install the “net-tools” package on your system:

$ sudo apt install net-tools

Now, execute the “ifconfig” command and find the “ip” address of your network devices in the list:

$ ifconfig

You can look for the “ip” addresses in the “ifconfig” binary executable file, located “/sbin” directory:

$ /sbin/ifconfig

How to find your IP Address in Linux using nmcli command

NetworkManager is controlled by utilizing the “nmcli” command-line utility. In Linux, the nmcli command is used for activating, deactivating, creating, editing, and deleting network connections and displaying network device status.

The basic syntax of the “nmcli” is as follows:

$ nmcli [Option1] [Object] [Option2]

In the “nmcli” command, “-p” and “show” options are used for printing the information related to network devices conveniently:

$ nmcli -p device show

How to find your IP Address in Linux using GUI method

Some users prefer to utilize the GUI of Linux for performing most of their tasks. In a Linux-based system, you can also use the Graphical User Interface or the GUI for finding your IP address. To do so, open up your system settings by searching it manually in the “Applications”:

In between all categories of the system settings, move to the “Network” and click on the “Gear” button available with your network device:

In the opened window, click on the “Details” tab, and from here, you can check out the “IPv4” and “IPv6” addresses of the selected network connection:

How to find your Public IP Address in Linux

Your Internet Service Provider (ISP) assigns a public IP address to your network router to make it accessible over the network. When you get connected with the internet using your public address, the private address of your network device remains unrevealed.

You can find out your public ip address you can write out “What is my ip” in Google’s search bar:

You can also “dig” command for finding out your public address using the Linux terminal. To do so, you can execute the below-given commands:

$ dig ANY +short @resolver2.opendns.com myip.opendns.com
$ dig ANY +short @ns1-1.akamaitech.net ANY whoami.akamai.net

The “wget” command can also be utilized for the same purpose:

$ wget -O - -q https://icanhazip.com/

By executing the above-mentioned “wget” command, your public address will be printed as an output on the terminal:

Conclusion

Want to try out a solution for any network issue or stuck in the middle of configuring a firewall? Knowing your IP address can assist you in such scenarios. In a Linux-based system, various commands are utilized for finding out the IP address, such as “ip”, “hostname”, and the “ifconfig” commands. This post showed you the method to find out your IP address using different Linux commands and the system GUI. Moreover, the procedure of finding the public IP address is also demonstrated.