Original URL: http://www.cnblogs.com/pang123hui/archive/2011/05/28/2309889.html
There are two types of additions:
First, temporary add
~$ Echo $PATH # Show Current environment variables
/usr/local/sbin:/usr/local/bin # Display example, multiple paths are separated by ":"
~$ path= "$PATH:/home/workdir" # Add "/home/workdir" directory
/usr/local/sbin:/usr/local/bin:/home/workdir # Display example, the middle of multiple paths is still separated by ":"
Then add success! (Of course, you can restart or output it for immediate effect:)
~$ Export PATH
~$ CD ~
~$ source. BASHRC #该命令需在主目录下才能运行, otherwise the prompt cannot be found. BASHRC command
End!
Ii. Permanent Changes
Open the ~/.BASHRC file to the last add command:
Path= $PATH:/home/workdir
Note that unlike the above, there are no double quotes and restart OK.
"Go" ubuntu Add PATH environment variable