Modify environment variable path path under Linux system

Source: Internet
Author: User

Method One:

Path= $PATH:/etc/apache/bin

This method is valid only for the current session, and each time you log off or take out the system, the setting is invalid

Method Two:

Vi/etc/profile

Write in the appropriate location: path= $PATH:/etc/apache/bin

$PATH is the default system environment variable path

/etc/apache/bin is the path to the environment variable that needs to be added

If/etc/profile is modified, then the source profile or the Execute Point command is executed after the edit finishes. The value of/profile,path will take effect immediately.

Method Three:

VI ~/.bash_profile

Modify the path line to add/etc/apache/bin

This approach is effective for users

To change path, you must re-login to take effect

The principle of this method is to execute the/etc/profile shell script again, note that if the use of sh/etc/profile is not possible, because SH is executed in the child shell process, even if the path changes will not be reflected in the current environment, but the source is in the current Shell process, so we can see the change in path.

Modify environment variable path path under Linux system

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.