The ifconfig command is a legacy tool used to configure network interfaces in Linux. Even though the utility was deprecated and replaced with the
ifconfig is still used and often comes preinstalled on modern Linux distributions. However, installing
ifconfig on Debian can be problematic.
This guide explains how to install ifconfig on Debian and fix the "command not found" error.
- Debian system (this tutorial uses Debian 11. The instructions also apply to Debian 10 and 9).
- Access to the terminal.
- Sudo privileges.
How to Fix ifconfig Command Not Found?
ifconfig command is part of the net-tools package, a Linux network utility deprecated because of a lack of maintenance and IPv6 support.
While certain distributions still have net-tools preinstalled, others, like Debian, don't. Therefore, when Debian users try to run
ifconfig, the output prints an error.
The error occurs either because the system does not have net-tools or because the
ifconfig directory is not added to the standard PATH variable.
The following sections explain how to fix the ifconfig "command not found" issue.
Method 1: Install net-tools
The first step to fixing the "command not found" error is to install net-tools. Do the following:
1. Update Debian repositories.
sudo apt update
2. Install net-tools with apt.
sudo apt install net-tools
ifconfig to confirm the installation.
The output above verifies the installation. However, in some cases, Debian won't execute
ifconfig even after the user installs
net-tools. The command prints the same error as before the installation:
This happens because the system installs
ifconfig in /sbin/, which is not a part of the standard user PATH variable. By default, regular users cannot invoke
ifconfig unless they add the command to PATH. However, workaround methods exist.
Method 2: Run ifconfig with sudo or as root
One way to run
ifconfig without adding the command to PATH is to use sudo or switch to root with su. If you only need to execute
ifconfig once, use sudo instead of su since the former is a safer option:
Method 3: Use the Full Path to the Command
Another option is to run the command as a regular user but to type in the full path to
The method works but requires users to remember the path, which is not practical if
ifconfig is used often.
Method 4: Update the System PATH Variable
sudo or the entire path to the command works but is not practical in the long term. When a user needs to run
ifconfig multiple times, it's best to add the /sbin/ directory to the PATH variable permanently.
To update the PATH variable, follow these steps:
1. Access .profile in Vim or another text editor.
2. Go to the end of the file in Vim.
3. Paste the following line:
export PATH=$PATH: /sbin/
5. Reboot the system to make the changes live.
The output shows that the command is working.
Note: To install
ifconfig for the current user only, change the $HOME/.profile file. To make changes system-wide, edit /etc/profile.
Method 5: Use an Alternative Command
ifconfig is a challenge to install and run on Debian. In modern distributions, ip is the go-to utility for network configuration.
ip tool is installed by default on Debian. Run the command without any options to see the basic functions:
ip command prints the list of network interfaces with the
link show arguments:
ip link show
After reading this tutorial, you know how to install
ifconfig on Debian. Next, learn how to change the hostname in Debian 10.