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

王林
Release: 2020-05-16 13:35:20
Original
4526 people have browsed it

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

Then check whether the addition is successful

echo $PATH
Copy after login
Copy after login

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

Open the .bashrc file

vi .bashrc
Copy after login

Add the following command in the last line:

export PATH=$PATH:/xxx/xxx
Copy after login
Copy after login

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

source.bashrc
Copy after login

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

Open the profile configuration file

vi /etc/profile
Copy after login

Add the following command in the last line

export PATH=$PATH:/xxx/xxx
Copy after login
Copy after login

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!

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