> ## Content Index
> Fetch the complete content index at: https://www.bagz.fr/llms.txt
> Use this file to discover other available public pages before exploring further.

# Escape sequences for SSH (when you're stuck)
- URL: https://www.bagz.fr/escape-sequences-for-ssh-when-youre-stuck/
- Published: 2016-09-27T08:14:23.000Z
- Updated: 2016-09-27T08:14:23.000Z
- Author: bgazui
- Tags: Linux, #Migrated-1790668826633, #wp, #wp-post, #Import 2026-09-29 08:00

You can get stuck with your ssh session when your network is changing or when there's a network disruption. You will face a lock leading to the unability to stop your session, even by doing a CTRL-C.

That's why there's some escape sequences you can use in that case (especially the first one when you're stuck):

 \~. - terminate connection (and any multiplexed sessions)  
 \~B - send a BREAK to the remote system  
 \~C - open a command line  
 \~R - Request rekey (SSH protocol 2 only)  
 \~^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.