Home >Operation and Maintenance >Linux Operation and Maintenance >What to do if the command is not recognized under Linux

What to do if the command is not recognized under Linux

王林
王林Original
2020-05-16 13:35:204500browse

What to do if the command is not recognized under Linux

Solution:

1. Directly modify the PATH value

First execute the following command to add the target path to PATH

export PATH=/usr/bin/:$PATH

Then check whether the addition is successful

echo $PATH

This method can take effect immediately, but the original PATH setting will be restored after the shell is closed, and is only effective for the currently logged in user.

2. Modify the .bashrc file (hidden file)

View the settings of the $PATH variable

echo $PATH

Open the .bashrc file

vi .bashrc

Add the following command in the last line:

export PATH=$PATH:/xxx/xxx

Enter the following command to take effect immediately and permanently, only for the current user

source.bashrc

3. Modify the profile file (in the /etc directory Next)

Open the profile configuration file

vi /etc/profile

Add the following command in the last line

export PATH=$PATH:/xxx/xxx

It will take effect permanently after the system restarts and is available to all users .

Recommended tutorial: linux tutorial

The above is the detailed content of What to do if the command is not recognized under Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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