Disconnecting from unresponsive connection

If you need to disconnect from an ssh session that became unresponsive, you can press Enter and then ~.. That'll take you back to your local shell.

Source