Linux environment variable Modification

Source: Internet
Author: User

 

Online majorityArticleContent:

(For example, add/sbin to the path environment variable)

(1) If you only want to add temporary modifications during the current Boot Process, the next boot will be invalid, you can:

Enter export Path = $ path:/sbin

(2) If only the current user is permanently added:

In ~ /.In bash_profile, a line similar to this path = $ path: $ home/bin is added near the end, and then it becomes Path = $ path: $ home/bin:/sbin.

Run source ~ /. Bash_profile command to make the modification take effect immediately

(3) If all users in the system are permanently added:

Add export Path = $ path:/sbin at the end of the/etc/profile file

After the file is modified and maintained, run the source/etc/profile command to make the modification take effect immediately.

 

 

In fact, the source/etc/profile command takes effect immediately in the current shell. If a new shell is opened, the $ path of the new shell is not added to the new path. Only after restart.

/Etc/profile:

 

For I in/etc/profile. d/*. Sh; do

If [-R "$ I"]; then

. $ I

Fi

Done

Echo Path = $ path:/sbin --- add this

Unset I

Unset pathmunge

 

 

PS:

Test in RedHat as4 environment.

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.