If you work on embedded Linux systems, those Docker container thingies, play around with Raspberry Pi or anything in between, you may occasionally find yourself on your main computer connected to the target via SSH when it suddenly hangs or gets rebooted, rendering your SSH session unresponsive. Sometimes when this happens, the SSH session gets disconnected automatically and you can start a new one. In other cases, the terminal with SSH open freezes and your usual hotkeys like
D do nothing. This is because
key presses are usually transferred to the target and the disconnecting is so to say engaged from there.
If only there was a hotkey that was detected by the SSH client before it tries to send it to the target 🤔. You guessed it, there is! The sequence
lets you disconnect from an unresponsive target without having to close the terminal or anything like that. To be clear, you press the keys one by one, no need to hold them all at once.
It does not work!
I had some troubles getting this to work reliably. Two things that helped me:
- Realizing the Enter key is part of the sequence. The first time I read about this, the sequence was said to be just Tilde + Period. Often when working in a terminal, Enter is the last key that was pressed so this works fine most of the time. Remember Enter as part of the sequence!
- Remembering how to type Tilde on my keyboard layout. Because I use a Swedish keyboard, Tilde is actually
is the key with
¨on it. Since there is no visual feedback when typing in the escape sequence (which is now five key presses), I would sometimes get it wrong.