Tag Archives: ifconfig command not found

How to Solve Linux Error: ifconfig command not found

1. An error is reported when inputting ifconfig command in Linux: ifconfig command not found

Ifconfig may not be installed. If not, install it

2. Check if ifconfig is missing. It is in/usr/SBIN directory

root@localhost ~]#Ll/usr/SBIN

check if there is ifconfig

if there is no ifconfig, install the net tools package

[ root@localhost sbin]# sudo yum install net-tools

 

Ifconfig command not found for Linux Installation Errors [How to Solve]

Problem Description:

Install Linux system with virtual machine VMware (the image file is centos-7.0-1406-x86 downloaded from the official website_64-DVD.iso),

After the installation is completed, enter the ifconfig command and an error is reported: ifconfig command not found

Solution:

1 determine whether ifconfig is not installed. If not, add it

2 determine whether it is not added to the environment variable. If not, add it

Solution:

First determine if ifconfig is missing, it is in the /sbin directory




[root@localhost ~]# cd /sbin
[root@localhost sbin]# ls

Check to see if ifconfig is present


If you don't have ifconfig, install net-tools package


[root@localhost sbin]# sudo yum install net-tools

Of course, if ifconfig already exists in the specified directory, it may also be caused by other problems, such as the environment variable is not added:

 

The original use ifconfig can be used, today is how, may be the installation software modified, Baidu ~ ~

[oracle@localhost /]$ ifconfig 
prompt: "bash: ifconfig: command not found" 
So I switched to the root user 
[root@localhost /]$ ifconfig 
It still says: "bash: ifconfig: command not found" 
Analyze the problem 
1. whereis ifconfig to see which directory the command is in 
2. echo $PATH to see if the directory is under the scrip, note that lunux is completely case-sensitive, so do not ignore this point 
3. Execute the command, you need to specify the path or add the directory to the PATH 
4. Then you can access it like this 
Method 1: [root@localhost sbin]$ /sbin/ifconfig can appear to use 
Method 2: [root@localhost sbin]$ export PATH=$PATH:/sbin , after setting this, you can access it directly next time, avoiding the trouble of the first one, such as: [root@localhost sbin]$ export PATH=$PATH:/sbin 
[root@localhost /]$ ifconfig 
Method 3: Modify the /etc/profile file, comment out the if statement 
Comment out the following if statement. 
# Path manipulation 
if [ "$EUID" = "0" ]; then 
pathmunge /sbin 
pathmunge /usr/sbin 
pathmunge /usr/local/sbin 
fi 
Modify to 
# Path manipulation 
# if [ "$EUID" = "0" ]; then 
pathmunge /sbin 
pathmunge /usr/sbin 
pathmunge /usr/local/sbin 
#fi 
Note: It is not only the ifconfig command that gives "bash: ifconfig: command not found", because the non-root user does not have /sbin/ifconfig in his path.

If the command "bash: ifconfig: command not found" is not only for ifconfig command, but also for other commands, the solution is the same.