5 Ways to Fix the ifconfig Command not Found Error on Debian

December 14, 2022


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 Install ifconfig on Debian


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.

ifconfig Debian terminal output

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
sudo apt update terminal output

2. Install net-tools with apt.

sudo apt install net-tools
sudo apt install net-tools terminal output

3. Run ifconfig to confirm the installation.

ifconfig Debian terminal output

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: 

bash: ifconfig: command not found

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:

sudo ifconfig
sudo ifconfig terminal output

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

/sbin/ifconfig terminal output

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

vim .profile

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

3. Paste the following line:

export PATH=$PATH: /sbin/
export PATH in Vim

3. Save and close the file.

5. Reboot the system to make the changes live.

6. Run ifconfig.

ifconfig Debian added to PATH terminal output

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

While effective, ifconfig is a challenge 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 on Debian. Run the command without any options to see the basic functions:

ip terminal output

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

ip link show
ip link show terminal output


After reading this tutorial, you know how to install ifconfig on Debian. Next, learn how to change the hostname in Debian 10.

Was this article helpful?
Sara Zivanov
Sara Zivanov is a technical writer at phoenixNAP who is passionate about making high-tech concepts accessible to everyone. Her experience as a content writer and her background in Engineering and Project Management allows her to streamline complex processes and make them user-friendly through her content.
Next you should read
How to Install and Use ifconfig on CentOS 7
January 12, 2021

The ifconfig command is a tool for network interface management that is used to...
Read more
Best Tools to Monitor Network Bandwidth on a Linux Server
May 4, 2019

There are many different tools for monitoring network traffic...
Read more
What is SNMP (Simple Network Management Protocol)?
October 20, 2022

This article explains what SNMP is, its basic components, and how it woks. See which network...
Read more
How to Find or Check Your IP Address in Linux
November 17, 2023

An IP address is a code assigned to a computer on a network. It works as a postal...
Read more