How to Fix the ifconfig Command not Found Error on Debian

Estimated reading: 3 minutes 693 views

The ifconfig command is a legacy tool used to configure network interfaces in Linux. Even though the utility was deprecated and replaced with the ip command, 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.

How to Fix ifconfig Command Not Found?

The 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.

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.

apt update

2. Install net-tools with apt

apt install net-tools

3. Run ifconfig to confirm the installation.

ifconfig

The output above verifies the installation.

Method 2: 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 ifconfig:

/sbin/ifconfig

Method 3: Update the System PATH Variable

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 Nano or another text editor.

nano .profile

2. Go to the end of the file in nano.

3. Paste the following line:

export PATH=$PATH: /sbin/

4. Save and close the file.

5. Reboot the system to make the changes live.

6. Run ifconfig

The output shows that the command is working.

Method 4: Use an Alternative Command

In modern distributions, ip is the go-to utility for network configuration.

The ip tool is installed by default on Debian. Run the command without any options to see the basic functions:

ip

The ip command prints the list of network interfaces with the link show arguments:

ip link show

Run the command command to list and show all ip address associated on on all network interfaces:

ip a

Conclusion

After reading this tutorial, you know how to install ifconfig on Debian.

Hopefully this article will be useful for you. Good luck !


Leave a Comment

Share this Doc

How to Fix the ifconfig Command not Found Error on Debian

Or copy link

CONTENTS