commit 70dd272be3e38fae1bdeb6ff8d3f58e37988305b parent 71f64f35adb65fea5198867d0370b352ccddbf76 Author: pyratebeard <root@pyratebeard.net> Date: Sun, 3 Jul 2022 23:29:49 +0100 the_great_ssh_escape Diffstat:
A | entry/the_great_ssh_escape.md | | | 25 | +++++++++++++++++++++++++ |
1 file changed, 25 insertions(+), 0 deletions(-)
diff --git a/entry/the_great_ssh_escape.md b/entry/the_great_ssh_escape.md @@ -0,0 +1,25 @@ +You have an ssh session on a remote system and your network drops. Your terminal is now stuck. We've all been there. + +Instead of killing the terminal you can use an ssh escape sequence to terminate the session. The sequence we want is `~.` (tilde and period). + +First key Return, then key the sequence `~.`. Your terminal is free! + +This isn't the only ssh escape sequence. To see others open an ssh session to a remote system and key `~?`, you will be presented with this message +``` +Supported escape sequences: + ~. - terminate connection (and any multiplexed sessions) + ~B - send a BREAK to the remote system + ~C - open a command line + ~R - request rekey + ~V/v - decrease/increase verbosity (LogLevel) + ~^Z - suspend ssh + ~# - list forwarded connections + ~& - background ssh (when waiting for connections to terminate) + ~? - this message + ~~ - send the escape character by typing it twice +(Note that escapes are only recognized immediately after newline.) +``` + +On occasion I use `~.` when I experience network drop out. I have used `~^Z` before to suspend my ssh session, useful when you want to leave jobs running and don't have screen or tmux available (see my post "[this ssux](20220331-this_ssux.html) on how I use tmux with ssh). + +The other escape sequences I have not used, but it is good to know they are there.