Modify environment variables and effective methods in Linux

Source: Internet
Author: User
Method 1: add a variable to the/etc/profile File (valid for all users permanently)] use VI to add a variable to the/etc/profile File. this variable will be valid for all users in Linux and will be permanent. Let the repair just now... method 1: add a variable to the/etc/profile File (valid for all users permanently)] use VI to add a variable to the/etc/profile File. this variable will be valid for all users in Linux and will be "permanent ". To make the modification take effect immediately, run the following code # source/etc/profile Method 2: in the user directory. add the variable "effective for a single user (permanent)" to the bash_profile file and use VI in the user directory. add a variable to the bash_profile file. the variable quantity is valid only for the current user and is "permanent ". To make the modification take effect immediately, you need to execute the following code in the user directory # source. bash_profile method 3: directly run the export command to define the variable [only valid for the current shell (BASH) (temporary)] use the [export variable name = variable value] to define a variable under the shell command line. this variable is only available in the current shell (BASH) or its subshell (BASH) if the shell is disabled, the variable becomes invalid. when the new shell is opened, the variable does not exist. if you need to use the variable, you need to define it again. Example: export PATH =/usr/local/webserver/php/bin: $ PATH
Related Article

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.