5 ms·
One of the many reasons why SSH is superior. Hit ~. and you're out.
by derpsabert 7y ago
One of the many reasons why SSH is superior. Hit ~. and you're out.
- ebg13 7y agoWhere do you see ~ on the AZERTY keyboard shown in the article?
- jerf 7y agoFor those who don't know about this, that's close, but a newline needs to precede the tilde: See https://linux.die.net/man/1/ssh https://linux.die.net/man/1/ssh and use browser find for "Escape Characters". I find this is one of those things that can pleasantly surprise people who have been using SSH for years without knowing about it. (Another one I see a lot is using the "authorized keys" to limit what command can be run with a particular key.) (Along with the utility of force-closing connections, this is also why it can be surprisingly difficult to use SSH in situations where you want a low-privilege user to be able to access the shell of a remote system, but not immediately get up to crazy network shenanigans. SSH is actually too feature-rich for that use case, and this escape-character menu is an example of why; even if you somehow take control of the command line entirely, they can still start opening reverse forwards and doing a variety of other things. Very useful for reasonably privileged users, though.)
- JdeBP 7y agoThe old rlogin manuals are better than the OpenSSH manual in this regard. * https://unix.stackexchange.com/a/454228/5132 https://unix.stackexchange.com/a/454228/5132
- zamadatix 7y agoHow is ~. supposed to be superior
- tyingq 7y agoYou can set the telnet escape character via "telnet -e <char>".
- raziel2p 7y agoThe tilde character can be surpisingly hard to type on some keyboards as well. I can't even figure out how to do it on my current keyboard because in place of the backtick/tilde key is the escape key. On a norwegian keyboard the tilde character is "dead", meaning you have to press the tilde character followed by spacebar to get it, and that might not work in situations like wanting to exit an SSH session due to... reasons.
- ASalazarMX 7y agoI just use the gold old ^D in an empty prompt. https://en.wikipedia.org/wiki/End-of-Transmission_character#Meaning_in_Unix https://en.wikipedia.org/wiki/End-of-Transmission_character#...
- derefr 7y agoThat's how you gracefully shut down an SSH session, with the socket close initiated from the remote end (where the shell is running.) \n~. is for gracefully exiting a stuck/hung SSH session (e.g. one where the remote isn't responding to input) without force-killing the SSH client itself (which might do bad things to the process group it lives in.)
- CamperBob2 7y agoUnfortunately not all Telnet servers support that. Being the least interesting programmer on Hacker News, I don't always write code to handle Telnet-compatible ASCII input, but when I do, I always support ^D.
- mprovost 7y agoThe tilde escape predates SSH - it comes from the cu (Call UNIX) program in BSD 4.2: https://github.com/dspinellis/unix-history-repo/blob/usr/src/BSD-SCCS-Import/usr/src/old/cu/cu.c#L29 https://github.com/dspinellis/unix-history-repo/blob/usr/src...
- aaubry 7y agoOn portuguese keyboards, ~ is a dead key. You have to type ~<space>.<enter> I'm not sure whether that's superior.