As discussed in Why ~/.bash_profile is not getting sourced when opening a terminal? on “Ask Ubuntu”, the shell running under tmux
is not a login shell.
How can I tell whether a shell is a “login shell”?
- Try typing “
logout
”. If the shell terminates, it was a login shell. If it says it isn’t a login shell, then it isn’t.- Type “
ps -fp$$
”. (Modify, if yourps
takes different args, to do whatever you need to in order to get a full/long listing of process information for the current shell –– “–p
” means “look at this process”, and “$$
” is the PID of the shell.) If the process name begins with a dash (hyphen), as in “-bash
” or “-csh
”, it’s a login shell; otherwise, it isn’t. (Probably.)
… so, the shell running under tmux
will not look at .bash_profile
; it will look only at .bashrc
. So move the commands that you want executed from .bash_profile
to .bashrc
, or put them both places, or make one source the other.