Always use tmux with ssh

Posted on

Put this in your .zshrc/.bashrc

function ssht(){
  ssh $* -t 'tmux a || tmux || /bin/bash'
}

Now

$ ssht user@host

will attach to existing tmux session, create new if one does not exist or just start bash if there is no tmux available.

Leave a Reply

Your email address will not be published.