Linux/UNXI system environment variables
1. What are environment variables? Simply put, it is to specify a directory. when running the software, the relevant program will find the relevant files according to the directory. The most practical function for setting variables is that you do not need to copy some dll files to the system directory. The path system variable is a series of paths for the system to search for dll files.
2. in Linux, If you download and install an application, the "command not found" prompt may appear when you type its name. It is too cumbersome to find the executable file in the installation directory every time. This involves setting the environment variable path, and the Path setting is also an integral part of customized environment variables in Linux.
Three methods for setting environment variables in Linux:
To add a PATH to $ PATH, perform the following operations:
1. Set in the console. This method is not supported, because it only works for the current shell and is invalid for another shell:
$ PATH = "$ PATH":/NEW_PATH (disabling shell Path will restore to the original path)
2. Modify the/etc/profile file. If your computer is used only for development and usage, this method is used because all users' shells have the right to use this environment variable, security issues may occur to the system. This is for all users, all shells
Add: export PATH = "$ PATH:/NEW_PATH" at the bottom of/etc/profile"
3. Modify the bashrc file. This method is more secure. It can control the permissions to use these environment variables to the user level. This method is for a specific user, if you want to grant a user permission to use these environment variables, you only need to modify. you can use the bashrc file.
Add the following content:
Export PATH = "$ PATH:/NEW_PATH"
Note: Once environment variables are set, they do not take effect immediately. You need to use the source command to re-load the configuration file, for example: source ~ /. Bashrc.
If the system does not have the source command, use the exit command to restart the terminal;