TMUX: Auto start on shell start

โ€”

by

in

I always want to use tmux. So I put the following in my bashrc (just before the functions).

# If not running interactively, do not do anything
# If you don't do this, your (graphical) login sessions will hang
[[ $- != *i* ]] && return

# If we are not yet in a screen session
if [[ $TERM != screen* ]]; then
  # Start tmux if there is no panicfile and tmux actually exists.
  [ ! -f /tmp/panic -a -x /usr/bin/tmux ] && exec tmux
fi