centos runs the installed command prompt that it cannot be found

王林
Release: 2020-04-03 13:27:44
Original
3049 people have browsed it

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
Copy after login

The prompt command does not exist.

Solution:

Use the following command.

# /sbin/ifconfig
Copy after login

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
Copy after login

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#设置变量为全局的
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template