DEV Community

loading...

Discussion on: Persistent SSH Sessions with Tmux

Collapse
sndp487 profile image
Sandeep

I was getting sessions should be nested with care, unset $TMUX to force at the top of tmux when using tmux attach || tmux new. What happens is tmux also executes .bashrc/profile.

So now I use this:

if [[ ! "$TERM" =~ "screen" ]]; then
tmux attach -t default || tmux new -s default
fi

in my .bashrc

TERM is set to 'screen' in tmux environment.