How To Terminate A Stalled SSH Connection

If you have to work of SSH with a flaky network connection you will have been left with an SSH terminal open to the remote server that is stalled or unresponsive. It will not accept any key presses but isn’t closed either.

I used to think that the only fix was to close the terminal window and SSH in again.

This isn’t the only option as SSH comes with some escape sequences. One of which is to terminate the current connection.

All you need to do is to type ~ then . then ENTER into the unresponsive terminal (sometimes you need to do this twice). The connection will be killed and you will be back on your local machine.