[Fixed] ifconfig command not found in Debian

The ifconfig command is the acronym of the “Interface Configuration” and is used to manage network interfaces. The interface management using the ifconfig command can be performed in the UNIX-based operating system including Debian. 

Sometimes using the ifconfig command in Debian, users might see the error “ifconfig command not found” on their computer screens.

In this post, we will walk through the reasons behind this error and also find solutions to fix it. 

What is the ifconfig Command in Debian?

The ifconfig is the command-line utility that is used to manage the networks, display their information, and configure them. This management can be applied to both physical and virtual network interfaces on Debian.

The basic functions of the ifconfig command in Linux are:

  1. It provides the configuration information of the network interfaces
  2. It can be used to activate as well as deactivate network interfaces 
  3. It can also be used to set the static IP address 
  4. It can also be used to set the MAC address of the machine

What are the Common Reasons Behind the “ifconfig command not found in Debian” error?

The most common reasons behind this error are: 

  • In the earlier releases of Debian, the ifconfig command utility was included in the “net-tools” package. The net-tools package comes in the default repository of Debian. However, in the latest releases, the package of net-tools is depreciated which means that the ifconfig command does not come pre-installed.
  • It is possible that intentionally or unintentionally the ifconfig command has been uninstalled or removed from Debian. 
  • Installing the outdated packages of “net-tools” may not contain the latest ifconfig command utility
  • The new releases are using the NetworkManager for managing the networks that use their own network commands. 

How to Fix the ifconfig command not found in Debian?

There are five different methods of solving this error which have been explained below. 

Method 1: Install net-tools Package

If the net-tools package has not been installed, then first update all the packages of the Debian:

$ sudo apt update

Then install the updated package of the net-tools by running the command:

$ sudo apt install net-tools -y

Method 2: Set the PATH Environment Variable

Another reason for seeing this error is that the ifconfig command is not included in the $PATH environment variable. List down the PATH variables to confirm the ifconfig command:

$ echo $PATH

If it does not contain the ifconfig command in the PATH variable, then run the command:

$ export PATH=$PATH:/sbin

Again display the $PATH Variable:

$ echo $PATH

Method 3: Upgrade the Debian System

If the net-tools package has been installed and the PATH environment variable has also been set up, then ensure that all the packages are up to date:

$ sudo apt update && sudo apt upgrade -y

Method 4: Run the ifconfig Command as a Superuser

Also, the ifconfig commands need to be executed as a super user. Try to run the command with the “sudo” to run it as a super user:

$ sudo ifconfig

Method 5: Use the Alternative of the ifconfig Command

It is stated earlier that the new releases of Debian are not containing the net-tools. Rather they are using the NetworkManager to manage the network interfaces on Debian. One can use the “ip” command instead of the “ifconfig” command to manage the networks:

$ sudo ip

These are the five different methods to fix the error of the ifconfig command not found in Debian.

Conclusion

To fix the ifconfig command not found in Debian, make sure the updated package of the net-tools has been installed on the computer. Also, its path has been included in the PATH environment variable. There are five different solutions to fix this error which have been explained in this article.