Linux environment variable setting file and linux environment variable setting

Source: Internet
Author: User

Linux environment variable setting file and linux environment variable setting

In Linux, environment variables include system-level and user-level. System-level environment variables are system variables that every user logging on to the system must read, user-level environment variables are the environment variables loaded by the user using the system. Therefore, files that manage environment variables are divided into system-level and user-level files.



System Level:

/Etc/profile this file sets the environment information for each user in the system. When the user logs on for the first time, this file is executed. And collect shell settings from the configuration file in the/etc/profile. d directory. Therefore, if you modify/etc/porfile, the modification takes effect only after the machine is restarted. This modification takes effect for every user. /etc/bashrc this file is executed by every user running bash shell. When the bash shell is opened, the file is read. If you want to modify a configuration for all bash users and the bash will take effect in the future, you can modify this file without restarting, re-open a bash or execute the source/etc/bashrc command.





User level:
~ /Bash_profile each user can use this file to input the shell information dedicated to the current user. When the user logs on, this file is executed only once. By default, it sets some environment variables to execute the user's. bashrc file. This file is similar to/etc/porfile. It takes effect only after being restarted./etc/porfile takes effect for all users ,~ /. Bash_profile only applies to the current user .~ /. Bashrc the file contains bash information for the current user's bash shell. The file is read at login and every time a new shell is opened. This file is similar to/etc/bashrc and does not need to be restarted to take effect. re-open a bash file or execute source ~ /. Bashrc will take effect, and/etc/bashrc will take effect for all newly opened bash by users, ~ /. Bashrc takes effect only for the newly opened bash of the current user.



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.