Home>Article>Operation and Maintenance> How to modify linux environment variables
Method: 1. Execute the "export PATH=$PATH:/usr/local/MATLAB/R2013b/bin" command to temporarily modify it; 2. Execute the "gedit /etc/profile" command and log out of linux. Linux environment variables can be permanently modified.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
How to modify the linux environment variables
Temporarily modify the environment variables
Open the Linux terminal In the command window, enter the following command:
export PATH=$PATH:/usr/local/MATLAB/R2013b/bin
In order to verify whether the modification is successful, you can continue to enter the command eport to view. In the picture below, you can see that the matlab environment variable has been successfully added.
After the above modification, if you exit the terminal and reopen it to view the environment variables again, you will find that the environment variables added above have disappeared. That is to say, this only temporarily modifies the environment variables.
Permanent modification of environment variables
If you want the environment variables to take effect permanently, you can modify either of the following two files:
1 /etc/profile
2 .bash_profile
Among them, /etc/profile is a global environment variable that takes effect for all users, while .bash_profile only applies to the current user Activate.
Enter the command:
gedit /etc/profile Open the profile file and add the following statements. After the input is completed, save and exit gedit
#After the above operation is completed, you need to log out of Linux to make the environment variable settings just take effect.
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to modify linux environment variables. For more information, please follow other related articles on the PHP Chinese website!