upvote
> typing on a line, backspacing all the way to the start and then typing ~ also sends a literal tilde

for the younger readers, yes, because in terminal echo mode, "backspacing" does not clear your terminal line buffer, those characters backspaced are already sent on the line. if you ever seen a misconfigured terminal, it hints what's going on, like:

user@host$ ls ~/^?^?^?^?^?~/a.out

^? is backspace's control char.

that is ssh watches what you type, not what is on the screen (terminal).

reply
The drawback is that if you think your session is hanging and want to bail with ~., you have to press enter, which might actually make it to the server and execute something.
reply
many get used to Ctrl-U, Return, ~, period keystroke sequence for this.
reply