The difference between/etc/profile and/ETC/PROFILE.D under the Linux environment

Source: Internet
Author: User

the difference between/etc/profile and/ETC/PROFILE.D under the Linux environment
Difference:
1. Two files are set environment variable file,/etc/profile is a permanent environment variable, is a global variable,/etc/profile.d/set all users to take effect
2./etc/profile.d/than/etc/ Profile good maintenance, do not want to what variables directly delete/etc/profile.d/under the corresponding shell script can, not like/etc/profile need to change this file


Each user in CentOS has to specify their own environment variables, which is more troublesome, so how to configure an environment variable, all users can use it?

The following is an example of JDK installation

VI /etc/profile.d/java.sh

in the new java.sh, enter the following:


#set Java Environment

java_home=/var/mysoft/jdk1.7.0_80
Path=$java_home/bin:$path
Export Java_home PATH

Save exit and assign permissions to java.sh: chmod 755/etc/profile.d/java.sh

The difference between/etc/profile and/ETC/PROFILE.D under the Linux 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.