Skip to content

Instantly share code, notes, and snippets.

@GitHK
Last active June 16, 2022 08:24
Show Gist options
  • Save GitHK/cdf111f9c56cb2f603ee4fe6f8fb8bf0 to your computer and use it in GitHub Desktop.
Save GitHK/cdf111f9c56cb2f603ee4fe6f8fb8bf0 to your computer and use it in GitHub Desktop.
remote tmux session
# Open a new tmux session or attach to existing tmux session given a name
rts() {ssh SSH_HOST -t "tmux attach-session -t $1 || tmux new -s $1";}

Add above to your shell profile

Form your temrinal use:

rts SESSION_NAME

The will create a remote tmux session or attach to an existing one.

Useful when travelling or dealing with bad connectivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment