Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is the difference between Linux environment variable settings / etc/profile, / etc/bashrc, ~ / .profile, ~ / .bashrc

Shulou Source: shulou.com Published: 2022-06-02 01:50:02 10月02日 Update

In this issue, the editor will bring you about the differences between Linux environment variable settings / etc/profile, / etc/bashrc, ~ / .profile, ~ / .bashrc. The article is rich in content and analyzed and described from a professional point of view. I hope you can get something after reading this article.

Log in to the system to read:

When logging in to the system to get a shell process, there are three steps to read the environment profile:

1. First read the global environment variable profile / etc/profile, and then read the additional set documents according to its contents, such as / etc/profile.d and / etc/inputrc

two。 Then, according to different user accounts, go to their home directory to read ~ / .profile. If this cannot read ~ / .bash_login, it will read ~ / .profile only if it cannot be read. The settings of these three documents are basically the same, and there is a priority for reading.

3. Then read ~ / .bashrc according to the user's account number

/ etc/* and ~ /. * difference:

/ etc/profile,/etc/bashrc is the system global environment variable setting

~ / .profile, ~ / .bashrc is the setting of private environment variables in the user's home directory.

The difference between ~ / .profile and ~ / .bashrc:

All have the function of personalized customization.

~ / .profile can set the user-specific path, environment variables, etc., which is executed only once when logging in.

~ / .bashrc is also a user-specific configuration document. You can set paths and command aliases, and use it once for every execution of shell script.

The above is the difference between setting / etc/profile, / etc/bashrc, ~ / .profile and ~ / .bashrc for the Linux environment variables shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Tags: Environment variable user content document system global time directory path account analysis different three professional personality small and medium user rich content alias Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux NVidia Shulou Tech Info Microsoft vpn