Skip to content

Instantly share code, notes, and snippets.

@frankamp
Last active December 27, 2015 02:59
Show Gist options
  • Save frankamp/7256572 to your computer and use it in GitHub Desktop.
Save frankamp/7256572 to your computer and use it in GitHub Desktop.
practical, up-enter friendly, multiple parameter friendly, ssh + fallthrough tmux->screen->bash for painless session resuming
# Usage: sssh name_of_session *ssh_args
# ex: sssh a -i identity.pem user@server.com
# will connect to or create session "a" on remote server with a certain identity
# Requires: bash.
# function needs to be exported into your shell, ex: put in .bashrc near aliases
# keep this handy http://www.mechanicalkeys.com/files/os/notes/tm.html
sssh() {
session="$1"
shift
ssh -t $@ "tmux a -t $session || tmux new -s $session || screen -S $session -dr || screen -S $session || /bin/bash"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment