Skip to content

Instantly share code, notes, and snippets.

@jpmens jpmens/profile.sh
Created Apr 5, 2019

Embed
What would you like to do?
tmux autostart via ssh
# .profile
...
# try to attach to tmux session or create a new one. When
# tmux exits (e.g. detach) we exit this session.
sname="t-$(hostname)"
if [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" != "" ]; then
tmux attach-session -t $sname || tmux new-session -s $sname
exit
fi
@jpmens

This comment has been minimized.

Copy link
Owner Author

commented Apr 6, 2019

@dne

This comment has been minimized.

Copy link

commented Apr 6, 2019

Note that line 11 can be simplified using the -A flag for for new-session.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.