Linux Service Shell environment variable path setting (CentOS)

Source: Internet
Author: User
Methods for modifying the path path of environment variables under the CentOS system

The essential part of the computer's brain is the operating system. And the development of Linux is very rapid, there is a trend to overtake Microsoft. This article introduces the knowledge of Linux, so that you learn to apply Linux system. For example, to add the/etc/apache/bin directory to path, there are three methods:

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

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

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


Note: To change path, you must re-login to take effect, the following methods can simplify the work:

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.
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.

This way you learn how to modify the environment variable path path under the Linux system.

Linux Service Shell environment variable path setting (CentOS)

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.