How to add your own path as a global path in Linux __linux

Source: Internet
Author: User
Original address

To add the/etc/apache/bin directory to path, there are three methods:

1. #PATH = $PATH:/etc/apache/bin
Using this method, only valid for the current session, which means that the PATH setting is invalidated whenever the system is logged out or logged out

2. #vi/etc/profile
Add Path= $PATH in place:/etc/apache/bin (Note: = no spaces on either side of the equals sign) This method is best, unless you manually force the value of the PATH, otherwise it will not be changed

3. #vi ~/.bash_profile
Modify the path line and add/etc/apache/bin to this method is for the user to work

Note: To change path, you must log on again to be effective, and the following methods can simplify your work:

If/etc/profile is modified, the source profile or execution Point command is executed after the edit is finished. The value of/profile,path will take effect immediately. The principle of this method is to execute a/etc/profile shell script again, note that if the sh/etc/profile is not possible, because SH is executed in the child shell process, even if the path changes will not react to the current environment, but source is in the current Shell process, so we can see the path change.

In general, the bin directory in the user's working directory is included in the path path, so just put the user's own shell script in the user's Bin directory and do not need to modify the configuration file.

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.