1

I have read that .bashrc is loaded when you open a non login shell (for example: xterm), and indeed when I opened xterm, .bashrc was loaded.

But when I opened a login shell (Ctrl+Alt+F#), .bashrc was also loaded!

I am using Ubuntu.

1

In Ubuntu, the user's default ~/.profile (copied from /etc/skel/.profile at account creation time) includes the following section:

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi

Hence, if the login shell is bash, it will source the user's ~/.bashrc as well.

  • I'd call that a bug, or at least a misfeature. – Kusalananda Apr 30 '17 at 22:36

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.