Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ifconfig command not found [closed]

I've just installed CentOS7 as a virtual machine on my mac (osx10.9.3 + virtualbox) Running ifconfig returns command not found. Also running sudo /sbin/config returns commmand not found. This is echo $PATH

/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/robbert/.local/bin:/home/robbert/bin

Is my path normal? If not, how can I change it?

Also, I don't have an internet connection on virtual machine yet, maybe that's a factor.

Please bear in mind i'm a student and very new to certain terminology.

like image 880
RobSeg Avatar asked Jul 19 '14 11:07

RobSeg


4 Answers

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
like image 104
Sean Avatar answered Oct 21 '22 03:10

Sean


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.

like image 41
Joachim Isaksson Avatar answered Nov 10 '22 17:11

Joachim Isaksson


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.

like image 24
user355859 Avatar answered Nov 10 '22 17:11

user355859


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 :)

like image 20
Paglian Avatar answered Nov 10 '22 18:11

Paglian