This is why calling the ifconfig command from the terminal returns an “ifconfig: command not found” error. If you still want to use ifconfig on your Linux system, you’ll have to manually install it.
If you tried to install the ifconfig utility and failed, it’s because ifconfig cannot be individually installed. It is included with the net-tools package. To be able to use the ifconfig command, you have to install the net-tools package first.
To install the package on Linux, fire up the terminal and run the command corresponding to the Linux distro that you’re currently running:
On Debian/Ubuntu derivatives, run:
sudo apt install net-tools
On Arch-based systems, run:
sudo pacman -S net-tools
To install the net-tools package on Fedora, CentOS, and RHEL, issue the following command:
sudo dnf install net-tools
This should install the net-tools package on your Linux system, following which you will be able to run the ifconfig command without any errors.
Installing net-tools should fix the issue, but in some cases, the “ifconfig: command not found” error might persist even with the net-tools package installed on your system.
In this case, you have to manually update the system PATH variable and add the ifconfig binary to it.
Start off by verifying whether the ifconfig binary exists in the system binaries directory. You can check by either manually navigating to the /sbin directory with the cd command and looking for the ifconfig binary or automating the process with this one-liner:
[[ -f /sbin/ifconfig ]] && echo "ifconfig exists"
The output of this command should be “ifconfig exists”. If it returns an error or doesn’t print the said phrase, you need to re-install the net-tools package. Once you get the desired output, check the contents of the PATH variable with this command:
Wade through the output and look for /sbin in it. Chances are you will not find it. If that’s the case, then export /sbin to your PATH variable with this command:
export PATH = $PATH:/sbin
Restart your Linux desktop after running this command. Upon boot-up, you should be able to use the ifconfig command flawlessly.
While you might find familiarity with ifconfig, it’s recommended you move on to updated tools that offer the same features with better performance.
When the net-tools package was declared deprecated, it was replaced with the iproute2 software suite that includes better alternatives like ip, cstat, arpd, nstat, devlink, ss, tc, and more.
The iproute2 package should already be installed on your Linux machine, so don’t worry about installation or configuration. You can simply run the commands.
To run the alternative to the ifconfig utility, type in this command:
You will find the output identical to that of the ifconfig command. You can get command-line help easily with the –help flag. Or if you want to learn more about each command, you can start by reading their man pages.
The Best Networking Commands for Linux
Linux is arguably the most popular operating system for servers and desktops alike. It never hurts to be familiar with a few useful commands that help with troubleshooting and configuring network settings. Since there are way too many networking commands to count, we’ve curated this list of some must-know Linux networking utilities.
About The Author