Skip to content

Instantly share code, notes, and snippets.

@thetristan
Created May 15, 2012 20:36
Show Gist options
  • Save thetristan/2704924 to your computer and use it in GitHub Desktop.
Save thetristan/2704924 to your computer and use it in GitHub Desktop.
Start tmux on ssh login
# Taken from http://william.shallum.net/random-notes/automatically-start-tmux-on-ssh-login
if [ "$PS1" != "" -a "${STARTED_TMUX:-x}" = x -a "${SSH_TTY:-x}" != x ]
then
STARTED_TMUX=1; export STARTED_TMUX
sleep 1
( (tmux has-session -t remote && tmux attach-session -t remote) || (tmux new-session -s remote) ) && exit 0
echo "tmux failed to start"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment