ifconfig command not found

I too had same problem after installation of RHEL,CentOS. Resolved with the following. Type:

vi ~/.bashrc

Press i key to go to insert mode. Write the following to the end of this file

export PATH=$PATH:/sbin

then exit Vi by press :wq!

At the terminal type below command to reflect our changes.

source ~/.bashrc

Now type the command ifconfig , it should work.


ifconfig exists in the net-tools package which may not be installed by default;

sudo yum install net-tools

When the package is installed, it will exist as /sbin/ifconfig.


In some cases. Installing net-tools is not enough directly.

Try this:

apt install net-tools

nano ~/.bashrc

Add this to your bashrc file.

alias ifconfig='/sbin/ifconfig'

Save the file.

source ~/.bashrc

ifconfig

The ifconfig command has been deprecated so it is not installed by default on many new distros. The replacement is

ip address

You can write a shortcut

ip a

Very handy :)