TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Terminating a Frozen SSH Session

55 点作者 erredois将近 5 年前

11 条评论

js2将近 5 年前
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 未加载
deeblering4将近 5 年前
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.
neilv将近 5 年前
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 未加载
farnsworth将近 5 年前
&gt; To view a list of available options with this escape trigger type `~.`<p>That should be `~?`
评论 #24077257 未加载
totetsu将近 5 年前
It&#x27;s ctrl+c ctrl+d ↵ ↵ ~.
评论 #24076883 未加载
评论 #24077349 未加载
0xdeadb00f将近 5 年前
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.
WatchDog将近 5 年前
Annoyingly the (not-ssh) AWS session manager cli doesn&#x27;t seem to implement this.
评论 #24077336 未加载
godelski将近 5 年前
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_将近 5 年前
Use mosh and never terminate a ssh session again.
riffic将近 5 年前
tilde dot is life.
traceroute66将近 5 年前
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 未加载