the linux environment variable settings

Three methods under Linux environment variable settings:

If you want to join a path to $ PATH, you can do something like this:

It works only for the current shell environment variables

1, the console settings, this is deprecated, because he works only for the current shell, for a shell set is invalid:

Direct console input: \ (the PATH = "\) the PATH": / new_path (closed shell Path will revert to the original path)

All users are functional environment variables

2, modify / etc / profile file, if your computer is just keep pushing as developed using this approach, since all users have the right to use the shell environment variables, may give the system security issues. This is for all users, all of the shell

vi / etc / profile

Add in the bottom of / etc / profile of: export PATH = "$ PATH: / NEW_PATH"

For the current specific user work environment variables

3, modify bashrc files, this method is more secure, it can have permission to use these environmental variables to control user level, here is tied to a specific user variables if you need to use these environments to a user privileges, you only you need to modify the .bashrc file in their personal user home directory on it.

we ~ / .bashrc

In the following is added:

Export PATH="$PATH:/NEW_PATH"

Guess you like

Origin www.cnblogs.com/7haoyu/p/11622310.html