Last active
August 29, 2015 14:14
-
-
Save draplater/ac7b8f402e1e06f3f404 to your computer and use it in GitHub Desktop.
tell ssh to use tmux as console manager.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias [server_name]="ssh -t [server_address] /home/[username]/.bin/tmux-new-or-attach secure-shell" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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