Skip to content

Instantly share code, notes, and snippets.

@draplater
Last active August 29, 2015 14:14
Show Gist options
  • Save draplater/ac7b8f402e1e06f3f404 to your computer and use it in GitHub Desktop.
Save draplater/ac7b8f402e1e06f3f404 to your computer and use it in GitHub Desktop.
tell ssh to use tmux as console manager.
alias [server_name]="ssh -t [server_address] /home/[username]/.bin/tmux-new-or-attach secure-shell"
#!/bin/sh
if ! tmux list-sessions -F "#S" 2> /dev/null | grep "^$1$"; then
echo "Start new SSH session."
tmux new-session -s $1
else
echo "Attach previous SSH session."
tmux attach -t $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment