bash: ifconfig: command not found solution

Method 1: [root@localhost sbin]$ /sbin/ifconfig can be used
Method 2: [root@localhost sbin]$ export PATH=$PATH:/sbin deal with the first kind of trouble, but only for one session

Method 3: The root user edits /etc/profile and appends export PATH=$PATH:/sbin at the end of the file, then source /etc/profile

Method 4: Modify the /etc/profile file and 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
is modified to
# Path manipulation
# if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
#fi

Note: Not only the ifconfig command appears " bash: ifconfig: command not found", the reason is that there is no /sbin/ifconfig in the path of the non-root user
, other commands can also appear in this situation, and the solution is the same.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327072052&siteId=291194637