Add the following to your .bashrc file.
if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
exec tmux
fiThis will:
- Check that tmux exists on the sytem.
- That an interactive shell is present.
- That we aren't already running tmux, to prevent it from running inside itself.
Add new comment