Search code examples
tmux

.bashrc/.profile is not loaded on new tmux session (or window) -- why?


When tmux starts or opens a new window, it does not load my .profile or .bashrc. I end up typing . ~/.bashrc every time. Is there a way to make this happen automatically?


Solution

  • Yes, at the end of your .bash_profile, put the line:

    . ~/.bashrc
    

    This automatically sources the rc file under those circumstances where it would normally only process the profile.

    The rules as to when bash runs certain files are complicated, and depend on the type of shell being started (login/non-login, interactive or not, and so forth), along with command line arguments and environment variables.

    You can see them in the man bash output, just look for INVOCATION - you'll probably need some time to digest and decode it though :-)