Method 1: Get the IP address with the ip address command
To find the machine’s IP address, run the command:
$ ip address
You can also use the short form of the previous command, shown below:
$ ip addr
Or you can simply run the command:
$ ip a
Method 2: Get the IP address with the ifconfig command
The next method for displaying the IP address on Debian is to use the ifconfig command. This command is used to configure network interfaces on Debian. To display the IP address using this command, run:
$ sudo ifconfig
If this command is not installed on the computer, you will need to install the net-tools package with the following command:
$sudoapt installnet-tools -y
Method 3: Get the IP address with the nmcli command
The “show” option of the nmcli command can be used to display the IP address of the Debian machine. For example, run the following command:
$ nmcli -p device show
The IP address will be displayed on screen, but if you get the error “nmcli: command not found”, you will need to install it by running the following command:
$sudoapt installnetwork-manager -y
Method 4: Get the IP address using the hostname command
Using the hostname command with the “I” option, you can get the machine’s IP address, as shown in the following command:
$ hostname-I
Method 5: Get the IP address with the ip route command
The ip route command can also be used to display the IP address on Debian with the following command:
$ ip route
As with the ip address command, the short form of the ip route command can also be used to get the same result as above:
$ip r
Conclusions
To get the IP address on Debian 12, you can use several commands, such as ip address, ip route, nmcli, ifconfig and hostname.
Enjoy!
