Home >Operation and Maintenance >CentOS >centos runs the installed command prompt that it cannot be found
Problem:
The command has been installed, but when executed, it prompts that it cannot be found.
For example, execute:
ifconfig
The prompt command does not exist.
Solution:
Use the following command.
# /sbin/ifconfig
Cause: The system default environment variable settings are incorrect.
Execute echo $PATH under ordinary users and root users respectively. There are four addresses missing in PATH: /sbin:/usr/sbin:/usr/local/sbin:/usr/kerberos/ sbin and ifconfig is just inside /sbin.
or
cat /etc/profile
can be found that there is no environment variable for /sbin.
su Enter root and run gedit /etc/profile
Add the following statement at the end of the file:
PATH=$PATH:/sbin #在PATH变量后追加/sbin目录 export PATH=$PATH:/sbin#设置变量为全局的
Save and exit.
Modify /home/user/.bash_profile and add the paths /sbin:/usr/sbin:/usr/local/sbin:/usr/kerberos/sbin after PATH.
After completing the modification, execute the command: . .bash_profile. You can also log out or restart to make the newly modified content take effect.
Recommended related tutorials: centos tutorial
The above is the detailed content of centos runs the installed command prompt that it cannot be found. For more information, please follow other related articles on the PHP Chinese website!