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...
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.
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.
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.
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 :)
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
Install nothing...
Just type sudo before ifconfig
for ex- sudo ifconfig
In Ubuntu Server 20.04 you have to install it:
sudo apt install net-tools
If you are not able to (or do not intend to) connect the virtual machine to the Internet (offline installation), then it would be best to add a CD/DVD drive to the SCSI controller, and mount the CentOS ISO file to this drive. Then, inside the virtual machine, perform the following command:
mount /dev/cdrom /mnt
You can access packages from the ISO via:
cd /mnt/Packages
find . -name "net-tools"
You should have at least one result returning <net-tools-filename>.rpm, for example, net-tools-2.0-0.22.20131004git.el7.x86_64.rpm. Install using that rpm file:
yum install <net-tools-filename>.rpm
Type y when prompted "Is this okay [y/d/N]:" and submit. Once installation is complete, you should be all right when prompting for the ifconfig command again.
If you install net-tools and the ifconfig is dispay as not found YOU CAN Creating aliases WHICH is relatively easy and quick process.
In order to do that you can use the following command:
alias ifconfig=/sbin/ifconfig
But this is not permanent is just temporary. In order to make it permanent use the following command:
sudo nano ~/.bashrc
Then you can add here your command at the bottom
#My custom aliases
alias home=”ssh -i ~/.ssh/mykep.pem tecmint@192.168.0.100”
alias ll="ls -alF"
alias ifconfig="/sbin/ifconfig"