Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've been using the ~. shortcut for a while, but somehow escaped learning about the help menu.

Another neat thing I noticed while playing with it just now: there's an option to enter ~ twice to send a literal ~, but usually you don't have to do this when typing something like 'ls ~' in a regular session. Not only does the ~ have to be the first character on a line to start an escape sequence, but typing on a line, backspacing all the way to the start and then typing ~ also sends a literal tilde. It only triggers the escape sequence if the ~ is the chronologically first character after a newline (or first in the session), which is an unlikely thing to type into a shell in a normal session. Good choice of UI, both the character and the state machine.



> 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).


Sometimes it’s ^H. You can use `stty -a` to inspect the current setting (backspace is what’s called “erase” there).


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.


many get used to Ctrl-U, Return, ~, period keystroke sequence for this.


For those of us in today's 10000, Ctrl-U is the default readline shortcut for unix-line-discard (see https://www.gnu.org/software/bash/manual/html_node/Commands-... and https://susam.net/unix-line-discard.html).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: