Linux method to modify the PATH path summary

  
                

Linux system operation, sometimes need to modify the environment variable PATH path, and friends who are not familiar with the system do not know how to modify, the following small series will introduce you how to modify the environment variable PATH path.

such put /etc /apache /bin directory to the PATH, there are three ways:

1. # PATH = $ PATH: /etc /apache /bin

Using this method, it is only valid for the current session, which means that the PATH setting will be invalidated after logging out or logging out of the system

2.#vi /etc/profile

Add PATH=$PATH:/etc/apache/bin in the appropriate location (note: = there can be no spaces on both sides of the equal sign)

This method is best unless you manually force the value of PATH to be modified. Otherwise it will not be changed

3.#vi ~/.bash_profile

Modify the PATH line and add /etc/apache/bin to it

This method is for User-friendly

System Home Xiaobian reminder: If you want to change your PATH, you must log in again to take effect. The following methods can simplify the work:

If you modify /etc/profile, the editing ends. Then execute the source profile or execute the point command. /profile, the value of PATH will take effect immediately.

The principle of this method is to execute the /etc/profile shell script again. Note that if you use sh /etc/profile, it is not possible, because sh is executed in the subshell process, even if the PATH is changed. Will react to the current environment, but the source is executed in the current shell process, so we can see the PATH changes.

The above is the introduction of Linux to modify the PATH path of the environment variable. This article introduces three methods of modification. Some methods need to be re-login to take effect, and special attention should be paid during operation.

Copyright © Windows knowledge All Rights Reserved