Skip to content

Instantly share code, notes, and snippets.

@ryandaniels
Forked from jpmens/profile.sh
Last active June 13, 2020 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryandaniels/c023044cb58568c406fa7a64a54d6c87 to your computer and use it in GitHub Desktop.
Save ryandaniels/c023044cb58568c406fa7a64a54d6c87 to your computer and use it in GitHub Desktop.
tmux autostart via ssh
# .profile
...
# try to attach to tmux session or create a new one.
# Uncomment exit if you want to exit this session
# when tmux exits (e.g. detach)
if [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" != "" ]; then
tmux new-session -As "t-$USER-$(hostname -s)"
#exit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment