Have always been in the environment variable distress, so I looked for information,
The Ubuntu Linux system contains two types of environment variables: System environment variables and user environment variables. System environment variables are valid for all system users, and user environment variables are only valid for current users.
Modifying user environment Variables
User environment variables are usually stored in the following file: ~/.profile ~/.bash_profile or ~./bash_login ~/.BASHRC
The above files are not recommended for use in Ubuntu 10.0 versions. System Environment Variables
System environment variables are generally stored in the following file: /etc/environment /etc/profile /ETC/BASH.BASHRC
To add an environment variable:
method One:
$ VI ~/.BASHRC
Add Path= $PATH on the last line:/my_new_path:
$source ~/.BASHRC
Method Two: Note: Modify the environment variable path. Specific: Modify the/ETC/BASH.BASHRC file (available to all users)
$sudo VIM/ETC/BASH.BASHRC
Add at end of file:
Export path= $PATH:/my_new_path:
after modifying the path, turn off the terminal and reopen the terminal (or reboot)
not enough time today. I'll write a detailed introduction to each of the differences next time .