ifconfig: command not found

Today I was setting up a new cloud server and needed to use the classic ifconfig command. I wasn’t able to do it because of this error:

ifconfig: command not found

It seems CentOS 7.x doesn’t come up with ifconfig installed by default on the minimal ISO image I used.

ifconfig command is no longer installed by default on CentOS because it has been replaced by the ip command, and marked as deprecated.

How can I fix ifconfig: command not found error?

Even it’s not officially recommended, if you grew with the ifconfig command as I did, here you will find a guide to install it on CentOS 7.x and latest Ubuntu versions.

Install ifconfig on CentOS 7.x

First things first. How can I find in what package ifconfig command is bundled?

By using yum provides command you can easily know the exact package name that provides the ifconfig system utility.

[[email protected] ~]# yum whatprovides ifconfig
net-tools-2.0-0.24.20131004git.el7.x86_64 : Basic networking tools
Repository : @base
Result obtained from:
File name : /usr/sbin/ifconfig

As you see, in CentOS Linux ifconfig command can be found inside the net-tools RPM package available in the default CentOS base repo. By using yum this can be installed easily within seconds:

yum install net-tools -y 

That’s all there is to it, you should now be able to use the ifconfig command.

Install ifconfig on Ubuntu and other debian based distros

On latest Ubuntu and other Debian based distros, the command has been deprecated too. In the same case as CentOS, it can be easily fixed by using apt-get command:

apt-get install net-tools

That’s it.

Conclusion

I’ve shown a simple and effective way to install ifconfig command on most popular Linux distros.

No special technical knowledge is needed for this, just the ability to use yum or apt-get from your terminal.

The ifconfig: command not found is a common error in these days for those who are used to the ifconfig command.

However, the new command replacement is the ip command, so, if you haven’t thought about start using it, you should.

About the Author: Martin Keler

Leave a Reply

Your email address will not be published. Required fields are marked *