What is the difference between .bash_profile and .bashrc

  
                                                                                                                                                                                         

/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. The shell settings are collected from the configuration file in the /etc/profile.d directory. ./etc/bashrc: Execute this file for each user running the bash shell. When the bash shell is opened, the file is read.~/.bash_profile: Each user can use this file to enter their own use. Shell information, when the user logs in, the file is only executed once! By default, he sets some environment variables and executes the user's .bashrc file.~/.bashrc: This file contains bash information specific to your bash shell. The file is read when logging in and every time a new shell is opened.~/.bash_logout: Execute the file each time you quit the system (exit the bash shell).

In addition, /etc/The variables set in the profile (global) can be applied to any user, and the variables set in ~/.bashrc, etc. (local) can only inherit variables in /etc/profile, they are "parents" relations.

~/.bash_profile is an interactive, login way to run into bash~/.bashrc is interactive non- The login mode is usually the same as the bash run, so usually the former will call the latter.



Copyright © Windows knowledge All Rights Reserved