Linux environment variable settings file

Source: Internet
Author: User

Environment variables in Linux include system-level and user-level, system-level environment variables are the system variables to be read by every user logged into the system, and the user-level environment variable is the environment variable that the user uses the system is loaded. So files that manage environment variables are also categorized as system-level and user-level.



System level:

/etc/profile This file sets the environment information for each user of the system, and the file is executed when the user first logs on. and collect the shell settings from the configuration file of the/ETC/PROFILE.D directory. So if there is a change to the/etc/porfile, the machine changes must be restarted to take effect, and this modification will take effect for each user./ETC/BASHRC This file executes for each user running the bash shell. When the bash shell is opened, the file is read. If you want to modify a configuration for all users who use bash and then open it later, you can modify the file, modify the file without restarting, reopen a bash, or execute the SOURCE/ETC/BASHRC command to take effect.





User level:
~/bash_profile Each user can use the file to enter shell information that is specific to the current user, which is executed only once when the user logs on. By default, it sets some environment variables to execute the user's. bashrc file, which is similar to/etc/porfile, requires a restart to take effect,/etc/porfile takes effect for all users, and ~/.bash_profile only for the current user. ~/. BASHRC This file contains bash information for the bash shell that is dedicated to the current user, which is read when logging in and every time a new shell is opened. This file is similar to/ETC/BASHRC, does not require a reboot to take effect, re-opens a bash or executes the source ~/.BASHRC to take effect,/ETC/BASHRC for all users of the newly opened bash, but ~/.BASHRC Only the new bash that was opened by the current user is active.



Linux environment variable settings 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.