As a deprecated utility, it’s not included by default on Linux distros these days. This is the main reason for the ifconfig command not found error as the package isn’t installed to start with. Additionally, non-root users don’t have the /sbin and /usr/sbin paths in their PATH variable, which also leads to this error. In this article, we’ve concisely explained how you can resolve this error in both scenarios and introduced the ip command for those interested in switching.

How to Fix ifconfig Command Not Found

Since ifconfig isn’t present to start with in most cases, we recommend that as a good place to start troubleshooting. 

Install ifconfig

Ifconfig is installed as part of the net-tools package, a collection of networking utilities, some of which you may have heard of or used like arp, netstat, and route.

On Debian-based distros, you can install net-tools with:sudo apt install net-toolsOn RedHat-based distros, you can use:sudo dnf install net-toolsOn Arch-based distros, you can instead use:sudo pacman -S net-tools

Resolve PATH Issues

Ifconfig is located in /sbin and /usr/sbin. Most distros won’t include these directories in the PATH variable unless you’re root. Due to this, the ifconfig command doesn’t get recognized, which leads to the ifconfig command not found error. You can confirm this by checking whether the ifconfig binary exists in said directories or not with the following commands:[ -e /sbin/ifconfig ] && echo “File exists.” || echo “File doesn’t exist.”[ -e /usr/sbin/ifconfig ] && echo “File exists.” || echo “File doesn’t exist.” Assuming the binary exists and the issue is with PATH, there are 3 ways to resolve the issue. First, you could add said directories to the PATH variable as such:export PATH="/sbin:/usr/sbin:${PATH}" Or, you could simply run the command with the full path as:/usr/sbin/ifconfig Or, the simplest method would be to just use sudo ifconfig. For Kali users specifically, it’s worth mentioning that Kali’s default user used to be sudo prior to 2020, but this was changed for security concerns. Now, the default user is lower privileged. So, in case you were wondering why ifconfig worked without sudo before, but it’s required now, this is the reason. 

Switch To ip

As stated, ifconfig is deprecated now, and it’s been superseded by the ip command, which is part of the iproute2 collection of utilities. The solutions we’ve detailed above will resolve the ifconfig command not working error, but honestly, the better move may be to simply upgrade to using ip. The equivalent of ifconfig is ip addr show, or simply ip addr, which can be further abbreviated as ip a. Some basic options include -s for stats, -h for human readable values, -d for details, and -c to configure color output.

How To Fix  ifconfig Command Not Found  Error  - 11How To Fix  ifconfig Command Not Found  Error  - 9How To Fix  ifconfig Command Not Found  Error  - 71