When you log in to the system, bash will first execute the global setup file /etc/profile and then it will look for the personal setup file in the following order (will stop on the first finding)
- ~/.bash_profile (Derived from the Bourne Shell’s file name .profile)
- ~/.bash_login (Derived from the C Shell’s file name .login)
- ~/.profile
If all 3 files exist and need to be used, source the other files from ~/.bash_profile
~/.bashrc will be executed when you run a subshell by typing bash on the command line.
If ~/.bashrc needs to be executed when you log in to the system, source the file from ~/.bash_profile