Close stuck SSH sessions describes this method, which works great.
press enter, tilde (~), and then period (.)
This works great, but I always forget the sequence of keys. I use bash, vim, and tmux, but I can't think of a way to automate this. Any ideas? Thanks!
I think tmux send-keys
command should do the trick.
Here's a snippet for your .tmux.conf
:
bind t send-keys "C-m" "~."
Notice C-m
is provided as a separate argument from tilde and dot. That way it's "recognized" as Enter
.
I tested this on the (regular, non stuck) ssh session by pressing prefix + t
and it worked.