What is the problem with ifconfig? The system prompts that the image cannot be found ~~ So Baidu ~~
[[Email protected]/] $ ifconfig
Prompt: "Bash: ifconfig: Command not found"
Switch to the root user
[[Email protected]/] $ ifconfig
Still prompt: "Bash: ifconfig: Command not found"
Analyze problems
1. whereis ifconfig: Check the directory in which the command is located.
2. Echo $ path: Check whether the directory is in the path. Note that lunux is case-sensitive, so do not ignore this.
3. to execute the command, you must specify the path or add the directory to the path.
4. You can access
Method 1: [[email protected] sbin] $/sbin/ifconfig
Method 2: [[email protected] sbin] $ export Path = $ path:/sbin. After this setting, you can directly access it next time, avoiding the first type of trouble, such:
[[Email protected]/] $ ifconfig
Method 3: 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
Change
# Path manipulation
# If ["$ EUID" = "0"]; then
Pathmunge/sbin
Pathmunge/usr/sbin
Pathmunge/usr/local/sbin
# Fi
Note: not only does the ifconfig command show "Bash: ifconfig: Command not found" because the path of a non-root user does not contain/sbin/ifconfig
Other commands can also be used in this case. The solution is the same.