News for hackers. Stuff that matters.
Re:What typing ^D does on Unix (2009) by alfanick on Tuesday September 06, 2016 @02:02PM (#12437949)
nice one, never seen that - always used ^D/exit
Re:What typing ^D does on Unix (2009) by wyldfire on Tuesday September 06, 2016 @02:09PM (#12437988)
Those are yet more graceful -- for when the shell is responsive. Use ~. in cases where for some reason you cannot get access to the terminal anymore but remote sshd is responsive.
Re:What typing ^D does on Unix (2009) by 0x0 on Tuesday September 06, 2016 @02:23PM (#12438094)
Actually the remote sshd does not need to be responsive, because "<cr>~." is interpreted by the local ssh client. Very convenient if the TCP connection is stuck.

You can also type "<cr>~?" for a list of other commands supported by the local ssh client. Among other things, "<cr>~C" opens a command line interpreter on the client side of the ssh client, allowing you to add and remove TCP port forwarding without restarting the connection.

Re:What typing ^D does on Unix (2009) by Tyr42 on Tuesday September 06, 2016 @04:20PM (#12439015)
Ahg, I wish it let you scp files into your working directory too. That's be convenient.
Re:What typing ^D does on Unix (2009) by thomashabets2 on Tuesday September 06, 2016 @09:09PM (#12440379)
Long ago I sent a patch for uploading downloading using this escape sequence, using zmodem like how an old windows SSH client (I forget the name) used to allow uploading/downloading files.

You log in, type "rz<enter>", and then use escape sequence to upload a file. (similar for downloading)

The patch was rejected. Shame. It's very useful when hopping 6 steps to upload a file.[1]

I can't find the patch now, but I'm considering rewriting it as a an `expect` script. My `expect` scripts tend to have trouble with SIGWINCH propagation though, so not optimal. Also you have to remember to wrap with the `expect` script at (and preferably only at) the one "jump" you want to send from/to with the final destination.

[1] No, nothing illegal. Just that some networks mandate SSH jumpgates, and sometimes multi-level.

Re:What typing ^D does on Unix (2009) by aji on Tuesday September 06, 2016 @02:18PM (#12438046)
~. (and the other ~ commands) are handled locally, not by the remote sshd. I use it when my network cuts out or something and my ssh session is unrecoverably stuck
Re:What typing ^D does on Unix (2009) by russb on Tuesday September 06, 2016 @02:32PM (#12438179)
You can also layer the number of ~'s to skip over intermediary SSH sessions and send the escape to the proper one.

\n~~. will escape the 2nd box you've SSH'd to, not the one it was originated from.

Useful for escaping a screen'd SSH session that you might access through a jumphost.

Re:What typing ^D does on Unix (2009) by abstractbeliefs on Tuesday September 06, 2016 @02:17PM (#12438039)
iirc, enter-~-. isn't anything to do with the remote sshd. Instead, it escapes to the local ssh client (enter-~) that it should close (.). Which is really useful for if the remote sshd blew up, or, more commonly, your connection was broken.