The difference between setting the environment variable configuration file under Linux

  

/etc/profile: This file sets the environment information for each user of the system. When the user logs in for the first time, the file is executed.

And collect the shell settings from the configuration file in the /etc/profile.d directory.

/etc/bashrc: Execute this file for each user running the bash shell. This file is read when the bash shell is opened.

~/.bash_profile: Each user can use this file to enter shell information that is specific to their own use. When the user logs in, the

file is only executed once! By default, he sets some environment variables to execute the user's. Bashrc file.

~/.bashrc: This file contains bash information specific to your bash shell, which is read when you log in and each time you open a new shell.

~/.bash_logout: Execute this file each time you quit the system (exit the bash shell).

In addition, the variables (global) set in /etc/profile can be applied to any user, and the variables (local) set in ~/.bashrc can only inherit from /etc/profile. Variables, they are "father and son" relationships.

~/.bash_profile is an interactive, login way to run into bash

~/.bashrc is an interactive non-login way to get into bash running

Usually both The settings are roughly the same, so usually the former will call the latter.

Copyright © Windows knowledge All Rights Reserved