upvote
Same with me, I'll still instinctively go for ~. when a connection has hung / dropped (usually because of a NAT via a rebooted firewall), but never even considered how ~ doesn't normally cause an issue. Never knew it had to be immediately following a newline. Also never knew about the other options, ~^Z in particular looks useful.

I wonder if anyone still remembers the ctrl-[ sequence in telnet. I think I only ever used the quit command in that though.

reply
It'll still work. OpenSSH doesn't care about output (for ~ stuff), only input, so if you type <enter>~. it will close the connection.
reply
Does not for me, not even with busybox sh and no funky escape codes in PS1 at all. It does with cat or yes running, so just something being output is not the problem… Hm.
reply
It does not. open ssh linux to mac, typing ~ just types it on fish shell prompt. It works after`cat` followed by ENTER
reply
Just type <enter> without cat, your shell will show you another prompt, and the ssh escape command will also work.
reply
No they are correct, fish seems to intercept this or something like that. Only works with cat.
reply
In newer versions, it's disabled by default and you have to do something like this to enable in ~/.ssh/config:

    Host *
    EnableEscapeCommandline yes
reply
`EnableEscapeCommandline` only controls the <Enter>~C commandline.

The reason that is disabled in current OpenSSH by default is OpenBSD `pledge` support:

https://security.stackexchange.com/questions/280793/what-att...

On my Linux,

    cat<Enter>~.
closes the connection as expected, and no ~ is shown in the terminal.
reply