TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Terminating a Frozen SSH Session

55 pointsby erredoisalmost 5 years ago

11 comments

js2almost 5 years ago
So much to learn, if only people would read man pages.<p><a href="https:&#x2F;&#x2F;linux.die.net&#x2F;man&#x2F;1&#x2F;ssh" rel="nofollow">https:&#x2F;&#x2F;linux.die.net&#x2F;man&#x2F;1&#x2F;ssh</a><p>See the &quot;Escape Characters&quot; section.<p>(Linux historically has terrible man pages compared to say the old SunOS man pages of yore, but the ssh man page is complete.)<p>(When I was first introduced to Unix, it was on SunOS. One day, I typed &quot;man intro&quot; [1]and about 8 hours of man page reading later, decided to call it a day.)<p>1. <a href="https:&#x2F;&#x2F;docs.oracle.com&#x2F;cd&#x2F;E19683-01&#x2F;816-0210&#x2F;6m6nb7m45&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;docs.oracle.com&#x2F;cd&#x2F;E19683-01&#x2F;816-0210&#x2F;6m6nb7m45&#x2F;inde...</a><p>(Here&#x27;s another thing you can do. Look at the list of commands in your PATH. I&#x27;ll bet you&#x27;re not familiar with all of them. Some will have curious names. Why not see what they do?)
评论 #24077297 未加载
评论 #24078721 未加载
评论 #24077229 未加载
deeblering4almost 5 years ago
Also, the ~ needs to be the first on the line, so the key sequence is often &lt;return&gt;~. to kill a hung session.<p>And good idea to ctrl-c ctrl-U before hitting return, just in case there was a command in the buffer and the session wasn’t actually hung up.
neilvalmost 5 years ago
The most comfortably I ever saw a person wield the telnet&#x2F;rsh&#x2F;ssh escape sequences was when I was an intern, visiting a Cray division, to port some software. He was juggling multiple hops, to get to a machine across the room, with the panels off.<p>I&#x27;m guessing that juggling multiple hops might&#x27;ve been ordinary in Internet-based supercomputing center practice at the time. Including through terminal servers?<p>Though it would&#x27;ve been aesthetically cooler to sit at the console of a front-end processor of a Cray or Connection Machine. <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Maxell#&#x2F;media&#x2F;File:Blown_Away_Guy_-_Maxell_ad.jpg" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Maxell#&#x2F;media&#x2F;File:Blown_Away_...</a><p>(I ended up creating some multi-hop-to-go-10-feet situations myself at that company, such as for crudely gatewaying from our main Sun-dominated engineering LAN, to some porting systems, such as VAXstations that were only on DECnet. Half of the engineers had been developing things like LAN-accessed in-circuit emulators, borrowing other workstations&#x27; tape drives through rsh as part of a local Unix command pipeline, etc., so they were also unusually comfortable with the hops.)
评论 #24077949 未加载
farnsworthalmost 5 years ago
&gt; To view a list of available options with this escape trigger type `~.`<p>That should be `~?`
评论 #24077257 未加载
totetsualmost 5 years ago
It&#x27;s ctrl+c ctrl+d ↵ ↵ ~.
评论 #24076883 未加载
评论 #24077349 未加载
0xdeadb00falmost 5 years ago
Is this an openSSH thing and therefore an OpenBSD &quot;thing&quot;? I only ask because openBSD&#x27;s `cu` uses the same ~. escape to exit out of a serial&#x2F;tty connection.<p>I honestly had no idea ssh implemented the same escape until I read this.
WatchDogalmost 5 years ago
Annoyingly the (not-ssh) AWS session manager cli doesn&#x27;t seem to implement this.
评论 #24077336 未加载
godelskialmost 5 years ago
Btw, this doesn&#x27;t work in zsh. It does work in bash. But I just lost my session from typing `~.` Don&#x27;t even have to press enter!
评论 #24077356 未加载
评论 #24077363 未加载
sam_lowry_almost 5 years ago
Use mosh and never terminate a ssh session again.
rifficalmost 5 years ago
tilde dot is life.
traceroute66almost 5 years ago
Am I missing something here ? Surely all the author of the blog post needs to do is put : ServerAliveInterval X ServerAliveCountMax Y In their client ssh config file ? (Where X &amp; Y are values that meet their needs)
评论 #24084180 未加载