when I write a blog, I find myself Linux Environment Variables this piece, belongs to the small white level, found that it is necessary to write a blog to consolidate this knowledge.
1. Display the system environment variables:
Echo $PATH
2. set a new variable:
Export JAVA_HOME=/USR
3. use the env command to display all environment variables
all environment variables are displayed when you tap env directly
4. use the unset command to clear environment variables
Set can set the value of an environment variable and clear the value of the environment variable using the unset command . If no value is specified, the value of the environment variable is NULL. Examples are as follows:
Export test = "Test" # Add an environment variable test
unset $test # Delete test environment variable
5. use the readonly command to set the read-only variable, and if you use this command, the variable cannot be modified and clear.
ReadOnly test# to set the environment variable test to read-only
Setting the environment variable location /etc/profile file
If you need to add new environment variables, you can also Add downstream
Export path= $PATH:/path1:/path2:/pathn
This article is from the "Technical Blog" blog, please be sure to keep this source http://185113800.blog.51cto.com/10229324/1840849
How to set and view system environment variables under Linux