pyratelog

personal blog
git clone git://git.pyratebeard.net/pyratelog.git
Log | Files | Refs | README

20220703-the_great_ssh_escape.md (1342B)


      1 You have an ssh session on a remote system and your network drops.  Your terminal is now stuck.  We've all been there.
      2 
      3 Instead of killing the terminal you can use an ssh escape sequence to terminate the session.  The sequence we want is `~.` (tilde and period).
      4 
      5 First key Return, then key the sequence `~.`.  Your terminal is free!
      6 
      7 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
      8 ```
      9 Supported escape sequences:
     10  ~.   - terminate connection (and any multiplexed sessions)
     11  ~B   - send a BREAK to the remote system
     12  ~C   - open a command line
     13  ~R   - request rekey
     14  ~V/v - decrease/increase verbosity (LogLevel)
     15  ~^Z  - suspend ssh
     16  ~#   - list forwarded connections
     17  ~&   - background ssh (when waiting for connections to terminate)
     18  ~?   - this message
     19  ~~   - send the escape character by typing it twice
     20 (Note that escapes are only recognized immediately after newline.)
     21 ```
     22 
     23 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).
     24 
     25 The other escape sequences I have not used, but it is good to know they are there.