5

Previously, when setting up a *NIX environment for the first time, I would put all of my shell customisations into .bashrc, with the following .bash_profile:

if [ -f $HOME/.bashrc ]; then
    . $HOME/.bashrc
fi

However, based on this answer and its associated comments, I've recently moved my PATH redefinition into .bash_profile.

What types of commands do you feel should go into .profile, .bash_profile, .bashrc (and any other dotfiles), and why?

10

They are read or not read in a specific order based on how the shell is invoked. The invocation section of 'man bash' will give the order and when they are read. It depends on if the shell is invoked as a interactive and/or login shell.

This link will tell you the 'why'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.