ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

linux – 在一个命令中退出所有SSH连接并关闭PuTTY

2019-08-08 22:52:04  阅读:709  来源: 互联网

标签:linux windows ssh exit putty


有没有办法退出所有SSH连接并以“一次性”关闭PuTTY?我在Windows 7中工作并使用PuTTY连接到各种Linux主机.

我发现自己工作方式的一个例子:

SSH to host1 with PuTTY...
banjer@host1:~> #...doin some work...ooh! need to go check something on host8...
banjer@host1:~> ssh host8
banjer@host8:~> #...doin some work...OK time for lunch. lets close putty...
banjer@host8:~> exit
banjer@host1:~> exit
Putty closes.

按上述方法,一次从host8到关闭PuTTY的任何方式?有时我发现自己最多有5到10个主机.我意识到我可以单击X来关闭PuTTY窗口,但我想确保使用exit命令正确关闭我的SSH连接.我也意识到我正在寻求如何增加懒惰的技巧.我会把它写成“我怎样才能更有效率”.

解决方法:

尝试使用ssh连接终止转义序列.

在ssh会话中,输入〜. (波浪点).键入时不会看到字符,但会话将立即终止.

$~.
$Connection to me.myhost.com closed.  

从男人1 ssh

The supported escapes (assuming the default ‘~’) are:
 ~.      Disconnect.
 ~^Z     Background ssh.
 ~#      List forwarded connections.
 ~&      Background ssh at logout when waiting for forwarded 
         connection / X11 sessions to terminate.
 ~?      Display a list of escape characters.
 ~B      Send a BREAK to the remote system (only useful for SSH protocol
         version 2 and if the peer supports it).
 ~C      Open command line.  Currently this allows the addition of port 
         forwardings using the -L, -R and -D options (see above). It also
         allows the cancellation of existing remote port-forwardings using 
         -KR[bind_address:]port.  !command allows the user to execute a 
         local command if the PermitLocalCommand option is enabled in
         ssh_config(5).  Basic help is available, using the -h option.
 ~R      Request rekeying of the connection (only useful for SSH protocol 
         version 2 and if the peer supports it).

标签:linux,windows,ssh,exit,putty
来源: https://codeday.me/bug/20190808/1625540.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有