"Linux" Linux environment variable/etc/profile,/ETC/BASHRC, ~/.BASHRC difference "turn"

Source: Internet
Author: User
Tags aliases

Transferred from: http://blog.csdn.net/qiao1245/article/details/44650929

--------------------------------------------------------------------------------------------------------------- ---------------------------------

==========================================================================================

Recently configured the Java and Scala environment variables, found that their own Linux under the/etc/profile,/ETC/BASHRC, ~/.BASHRC is not particularly clear, we have consulted the relevant information, collated, for later review. If there are errors, I hope you will criticize them.
①/etc/profile:
When the file logs on to the operating system, the environment information is set for each user, and the file is executed when the user logs on for the first time. This means that the file is valid for each shell and is used to obtain information about the environment of the system.

#/etc/profile# System wide environment and startup programs, for login setup# Functions and aliases go in/etc/bashrc# It ' s not a good the idea to the change of this file unless know, what you# is doing. It ' s much better to create a custom.sh shell script in#/etc/profile.d/to do custom changes to your environment, as thi S# 'll prevent the need for merging on future updates.

②/ETC/BASHRC:
This file is executed for each user running the bash shell and is read when the bash shell is opened. That is, when the user shell executes bash, it runs the file.

#/etc/bashrc# System wide functions and aliases# environment stuff goes in/etc/profile# It ' s not a good idea to change t His file unless your know what you# is doing. It ' s much better to create a custom.sh shell script in#/etc/profile.d/to do custom changes to your environment, as thi S# 'll prevent the need for merging on future updates.
 

③~/.bashrc
This file stores information that is specific to the individual bash shell, and executes the file when it is logged in and every time a new shell is opened. In this file, you can customize the user-specific personal information.

So when the user logs on to the system, what is the relevant file execution order?
When you first log in to Linux, start the/etc/profile file, and then start one of the ~/.bash_profile, ~/.bash_login, or ~/.profile files in the user directory, in the following order: ~/.bash_ Profile, ~/.bash_login, ~/.profile. If the ~/.bash_profile file exists, the ~/.BASHRC file is typically executed.

"Linux" Linux environment variable/etc/profile,/ETC/BASHRC, ~/.BASHRC difference "turn"

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.