3 Ways to fix ifconfig command not found in Linux

Table of Contents

If you’re having trouble with the ifconfig command not found in Linux, don’t worry – you’re not alone. This is a common issue that can often be fixed quite easily. In this blog post, we will discuss three ways to fix this problem.

We will also provide some tips on how to avoid it in the future. Let’s get started!

Understanding ifconfig command

The ifconfig command is a powerful tool used in Linux to check and configure network interfaces.

It can be used to check IP addresses, check connectivity, configure IP addresses, check packet network loss, and much more.

3 ways to fix ifconfig command not found issue in Linux

When the “ifconfig: command not found” error appears in Linux, it typically means that the ifconfig binary is not installed or the path of the binary file is not under the $PATH.

So we can use the following 3 ways to fix this issue.

  • install net-tools package
  • run ifconfig command with full path
  • add the directory path of the ifconfig command to the $PATH


Install net-tools package in Linux

The ifconfig command is part of the net-tools package in Linux.

First, let’s check if you have installed net-tools package in your system.

On RedHat, Centos, and Fedora, you can use this command: rpm -qa|grep net-tools

On Ubuntu, Debian, and Mint you can use this command: dpkg –list|grep net-tools

If the output is empty, it means that the package is not installed on your system. You will need to install it with:

On RedHat, Centos, Fedora: yum -y install net-tools

On Ubuntu, Debian, Mint: apt-get install net-tools

Once the installation is completed, try running ifconfig again and it should work.

Related: 5 ways to list installed packages in Linux

Run ifconfig command with full path

If the net-tools package is installed but the ifconfig command still won’t work, you can try running it with full path.

In Linux, type “which ifconfig” to find out the location of ifconfig command. Then run “/path/to/ifconfig” and it should work as expected.

You can run these commands:

On RedHat, Centos, Fedora: /usr/sbin/ifconfig

On Ubuntu, Debian, Mint: /sbin/ifconfig

Add ifconfig binary to $PATH location

The third option to fix this problem is to add your ifconfig binary to the $PATH location.

The $PATH variable is an environment variable that contains the list of directories where your system looks for executables.

You can use echo $PATH command to check the current value of this variable.

If the directory of ifconfig binary is not listed, you will get “ifconfig command not found” error.

In this case, you can add the ifconfig directory path to the $PATH variable.

On RedHat, Centos, Fedora: PATH=$PATH:/usr/sbin/

On Ubuntu, Debian, Mint: PATH=$PATH:/sbin/

Once you have updated the $PATH variable, try running ifconfig again and it should work.

Tips: different users use different $PATH configuration. You can try to switch to root user to try ifconfig command.

That might work because the $PATH for root user has more directories. 


To avoid this issue in the future, make sure you install the net-tools package on your system. If it’s already installed, check that the ifconfig binary is located in one of these locations: /usr/sbin/ifconfig (RedHat,Centos,Fedora) or /sbin/ifconfig (Ubuntu, Debian, Mint).

Also make sure that the $PATH environment variable includes one of these locations. You can check this by running “echo $PATH” in your terminal window.

By following these steps, you should be able to avoid the “ifconfig: command not found” error in the future.

We hope you found this blog post helpful and that it helped you solve your problem. If you have any questions or comments, please feel free to leave them in the comment section below. Thanks for reading!

Related: 5 ways to install package in Linux

David Cao
David Cao

Hey there! I am David, a Cloud & DevOps Enthusiast and 18 years of experience as a Linux engineer. I work with AWS, Git & GitHub, Linux, Python, Ansible, and Bash. I am a technical blogger and a Software Engineer, enjoy sharing my learning and contributing to open-source.