How to set and view system environment variables under Linux

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.