Tuesday, December 25, 2012

Bash Shell : .bash_profile and .bashrc

Whenever a new shell is run, to set environment variables, aliases and export them automatically, the following files come handy

  • ~/.bash_profile - executed automatically for all login shells
  • ~/.bashrc - executed automatically for all non-login shells ( when bash is explicitly typed on the command line or when a script that starts with #!/bin/bash is run )
We may also find .bashrc file which sources .bash_profile, as follows

. $HOME/.bash_profile

No comments:

Post a Comment