The ifconfig command is a legacy tool used to configure network interfaces on Linux. Even though the utility was deprecated and replaced by the ip command, ifconfig is still used and often comes pre-installed 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.
- (this tutorial uses Debian 11. The instructions also apply to Debian 10 and 9).
- Access to the terminal.
- Sudo privileges.
How to fix ifconfig not found command?
The ifconfig command is part of the net-tools package, an outdated Linux network utility due to lack of maintenance and IPv6 support.
While certain distributions still have pre-installed networking tools, others, such as Debian, do not. Therefore, when Debian users try to run ifconfig, the output prints an error.
The error occurs 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 troubleshoot the ifconfig “command not found” issue.
Method 1: Install
The first step to fix 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
3. Run ifconfig to confirm the installation.
The above output verifies the installation. However, in some cases, Debian will not run ifconfig even after the user installs net-tools. The command prints the same error as before installation:
This happens because the system installs ifconfig in /sbin/, which is not part of the standard user PATH variable. By default, normal users cannot invoke ifconfig unless they add the command to PATH. However, there are alternative methods.
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 run ifconfig once, use sudo instead of su
, as the former is a safer option: sudo ifconfig
Method 3: Use
the full path to
the command Another option is to run the command as a normal user, but type the full path to ifconfig: /sbin/ifconfig
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
Using sudo or the entire path to the command works but is not practical in the long run. When a user needs to run ifconfig multiple times, it is 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/
3. Save and close the file.
5. Restart the system to make the changes live.
6. Run ifconfig.
The output shows that the command is working
Method 5: Use an alternate command
While effective, ifconfig is challenging to install and run on Debian. In modern distributions, ip is the go-to utility for network configuration.
The ip tool is installed by default in Debian. Run the command without any options to view the basic functions
: ip The ip
command prints the list of network interfaces with the link Show arguments: ip link
After reading this tutorial, you know how to install ifconfig on Debian. Next, learn how to change the hostname in Debian 10.