Saturday, April 23, 2011

Understanding the difference between .bash_profile, .bash_logout and .bashrc

Important Notes on bash file
  1. These files in your home directories have special meaning to bash, providing a way to setup the account environment when you log in and when you invoke another bash command
  2. If the files are not found in your home directory, you are using the default system on /etc/profile
  3. Most important is the .bash_profile which is read and the command in it is executed by bash every time you logged on to the system.
  4. .bashrc is invoked when you start a new shell or by typing bash on the command line.
  5. If you just need to have the same command run regardless of  a subshell or a login shell, you can easily source .bashrc and hence execute .bashrc from within .bash_profile
  6. .bash_logout is read and executed every time a login shell exits.

No comments: