Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a user (non-root) which has a ~/.bashrc file with some aliases in it.

But it doesn't look like the file is executed at log in time. If I do source ~/.bashrc then it does what it's supposed to. But isn't ~/.bashrc supposed to be executed every time I log in?

Permissions are set to 644 (same as my root's .bashrc, which works fine). File is owned by the user in question.

share|improve this question
This is one of the several annoyances ksh users experience when dealing with bash. ksh sources automatically .kshrc in a login shell but bash doesn't source .bashrc in the same context. You have to do it explicitly. – jlliagre Nov 18 '11 at 0:29
up vote 7 down vote accepted

~/.bashrc is for non-login interactive shells. Login shells source ~/.bash_profile (or ~/.bash_login or ~/.profile). Sourcing your ~/.bashrc there will allow you to have common settings.

share|improve this answer
Or source .bash_profile from .bashrc, which might make sense when you primarily use interactive shells. – janmoesen Nov 3 '11 at 19:55
I've felt the need to do things for login shells that weren't done for interactive non login one, never the reverse. – AProgrammer Nov 3 '11 at 20:47
Hence "might make sense": I know it can come across as backwards. :-) – janmoesen Nov 3 '11 at 21:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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