Add and remove environment variables PATH path in Linux system

  

http://blog.csdn.net/pipisorry/article/details/39507699

Linux system should put /etc/apache/bin directory Add to PATH: 1.#PATH=$PATH:/etc/apache/bin Use this method, only valid for the current session, that is, every time you log out or log out of the system (the terminal will be disabled), PATH The setting will be invalid. 2.#vi /etc/profile Add PATH=$PATH:/etc/apache/bin in the appropriate location (Note: = there is no space on both sides of the equal sign) This method is best unless you manually force it Modify the value of PATH, otherwise it will not be changed. 3.#vi ~/.bash_profile Modify the PATH line and add /etc/apache/bin. This method is for users. Note: If you want to change PATH, you must re-login. To be effective, the following methods can simplify the work: If you modify /etc/profile, then execute the source profile (source /etc/profile) or execute the dot command./profile after editing, 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, it will not reflect the current environment. , but the source is executed in the current shell process, so we can see the PATH change. This way you learn how to modify the PATH path of the environment variable under Linux. Supplementary notes Working environment setting file There are two kinds of environment setting files: system environment setting file and personal environment setting file 1. User working environment setting file in the system: Login environment setting file: /etc/profile Non-login environment setting file: /etc /bashrc 2. User settings environment settings file: Login environment settings file: $HOME/.bash_profile //This is where the environment variable is set. Non-login environment settings file: $HOME/.bashrc //This is the place to define the alias Login environment: refers to the working environment after the user logs in to the system. Non-login environment: refers to the user environment used by the user to call the subshell

from:http://blog.csdn.net/pipisorry/article/details /39507699

ref:http://opsmysql.blog.51cto.com/2238445/665990

Copyright © Windows knowledge All Rights Reserved