Linux how to find ip address

In our daily computer work, we need to know the IP address of our machine from time to time. This tutorial lists three ways you can use to find the IP address of your local network card in Debian 11 with the help of the terminal.

Using ifconfig command

A widely used command to find a network configuration is the ifconfig command. If it is not installed on your machine (which was the case on my system), you can install it by following the procedure.

Open the terminal with root privileges and execute the following command to install net-tools packages.

apt-get install net-tools

Wait for the command to finish.

When you have successfully installed the ifconfig command on your machine, execute it on the terminal.

ifconfig

Get IP address using ifconfig command

You will see which IP address is bound to which network interface. This is your private IP address. If you want to check the network configuration for a particular interface, the command should look like the following.

ifconfig <interface>

Replace <interface> with the interface that you like to look up. In my example, the network interface is ens33.

List the IP address for a specific network interface

You will get a list of all private IP addresses on this interface.

Using ip addr command

The second command you can use to find an IP addresses is the ip command. Execute “ip addr” on the terminal.

ip addr

Linux ip addr command

You will see which IP is bound to which interface in the command output.

Using hostname command

The last command you can use to find an IP address is by executing the hostname command as follows.

hostname -I

You will have the following result on your terminal.

Get IP address by using hostname command

These are all the methods you can use to find the network configuration of your machine. Finding your public IP address is not that easy, especially when your system is behind a NAT router. Have a look at this guide if you like to know the public IP and even geolocation of the IP. Enjoy!!

Linux Basics: 3 Ways to find your local IP Address in Debian 11