Open In App

addresses Command in Linux with Examples

Last Updated : 05 May, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Many times, working with the Linux Operating System we need to find the IP address of a particular device on our network. It is a very essential skill for a Linux system administrator to know how to find the IP address in the Linux Operating System whether we are finding issues with network connectivity or configuring network services. In this article, we are going to discuss some common methods to find the IP address in a Linux operating system.

Some Common Methods to Find IP Address in Linux.

1)  Using the `ifconfig` command

The most commonly used command is to find the IP address of a system in Linux. This command displays the network interface and their IP address.

Syntax:

ifconfig
ifconfig

ifconfig

In this Output, we can see three network interfaces enp0s3, enp0s8, and lo. The IP address of the enp0s3 network interface is `10.143.90.24`.

2) Using the `ip` command

IP address command is a part of the IP command in Linux. IP command is used to deal with IP address, ARP cache entry, tunnel over IP, routing table entry, etc. of all the network devices on a system, it is a replacement of the old ifconfig command in Linux.  More details on the IP command can be found here. IP address command is used to deal with protocol addresses (IP, IPv6). It becomes particularly helpful when dealing with systems with numerous network devices. It gives the user the ability to monitor all the devices and modify the addresses, when necessary, as well as add or remove network devices. There are two abbreviations of IP address, namely: IP a and IP addr.

Let’s see some examples, of how to use the IP address command.

IP address
or
ip a
or
ip addr
ip a

ip a

Display all the network devices with IPv4 address addresses only.

ip -4 addr
ip -4 addr

ip -4 addr

 Display all the network devices with IPv6 address addresses only

ip -6 address
ip -6 address

ip -6 address

Display network information of a specific interface.

ip a show dev {interface}

Example:

ip a show dev enp0s3
ip a show dev enp0s3

ip a show dev enp0s3

3) Using `hostname` command

This command is basically used to display the current hostname of the system. But we can use it to display Ip address associated with the hostname.

Syntax:

hostname -I
hostname -I

hostname -I

4) Using `nmcli` command

The NetworkManager command line tool (nmcli) is another way that we can use to display the network information, including IP address.

Syntax:

nmcli device show
nmcli device show

nmcli device show

IP address is listed under the “IP4.ADDRESS [1] :” and the value is `10.143.90.24` .

5) GUI (Graphical User Interface) way to find IP address

Step 1: Go to search box and type “network”, Click on network.

Click on network.

Click on network.

Step 2: Click on the settings Icon shown below.

settings Icon

settings Icon 

Step 3: Now we can see our IP address.

 IP address.

 IP address.

Frequently Asked Question 

How to solve Issue of “Operation not permitted” or “access denied”?

If the user faces any issue like “Operation not permitted” or or “access denied” try using the same command with sudo privilege.

How do I find IP addresses of other devices on my network?

We can do this by using the tool “nmap”, first we have to install this using “sudo “yum or dnf or apt-get” install nmap” if it is not.

Then

Syntax:

sudo nmap -sn (your_IP_address)
sudo nmap -sn (your_IP_address)

sudo nmap -sn (your_IP_address)

How can I see my public IP address in Linux?

By using `curl` command.

Syntax:

curl ifconfig.me
curl ifconfig.me

curl ifconfig.me

 Conclusion

It is crucial and important for Linux system administrators to find the IP address of a device. We have discussed many methods to find IP addresses in Linux Operating Systems like using ifconfig, ip commands, hostname command, nmcli command and GUI way. If someone wants to find their IP address or their system, they can easily find it by referring to this article. In this end we have also discussed that curl command can be used to find the public IP address of our system.



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads