to start tmux on login add the following to your ~/.bashrc
# Start Tmux by default # If not running interactively, do not do anything if command -v tmux>/dev/null; then [[ ! $TERM =~ screen ]] && [ -z $TMUX ] && exec tmux fi
Auto attach
to automatically attach to last session or create a new if none available extend your ~/.bashrc and ~/.tmux.conf with the following
~/.bashrc
# Start Tmux by default # If not running interactively, do not do anything if command -v tmux>/dev/null; then [[ ! $TERM =~ screen ]] && [ -z $TMUX ] && exec tmux attach fi
~/.tmux.conf
# if run as "tmux attach", create a session if one does not already exist new-session -n $HOST