解决远程登陆误按ctrl+s锁屏假死恢复

使用putty时,屏幕假死的问题

很多刚从windows转移到linux上来工作的朋友,在用vi/vim编辑文件时,常常会习惯性的按下Ctrl+s来保存文件内容.殊不知这样按下去后面会造成整个终端不响应了,ssh连接还好说,直接关闭ssh连接再重新连接就可以了,但在服务器前使用的话,就只能眼睁睁的看着干着急,稍微懂点的就用alt+f2/3/4切换到其他控制台去操作了.
其实正确的方法是ctrl+q来解除锁定,ctrl+s在linux下是锁定屏幕显示的意思和ScreenLock键是一个效果,不信你试试按下ScrLk或者Fn+ScrLk.


如果不想再遇到的话,来把flow control整个关掉,同时ctrl+s可以解放出来用做readline历史搜索.
下面再多介绍点ctrl快捷键的知识:
ctrl+c 结束正在运行的程序【ping、telnet等】
ctrl+d 结束输入或退出shell
ctrl+s 暂停屏幕输出
ctrl+q 恢复屏幕输出
ctrl+l 清屏,【是字母L的小写】等同于Clear

使用putty时,偶尔发生屏幕假死,不能输入等情况。

后来发现,只要数据ctrl+s,就会假死;输入ctrl+q就可以恢复过来。

ctrl+s是一个古老的shell控制键,再输入ctrl+q就可以恢复了。
When you use terminal/putty/secureCRT, you can mistakenly type ctrl-s. It makes terminal freeze. It is because ctrl-s is an flow control signal to terminals. To resume the terminal, you should push ctrl-q.

This is not very convenient solution. We use ctrl-s a lot, especially for EMACS users. To prevent this, you can add this line in your login script (e.g. .bashrc)

stty stop undef
You can confirm this setting using this command.

stty -a
The stop section should be undef.

putty作为著名的SSH客户端,经常用于登陆远程服务器。在上面编辑文本,特别是用vi打开两个文本,并且需要切换时,很容易出现卡死的现象,不能接受任何的键盘输入。很是郁闷。以前每次遇到这个问题,我只有关掉那个session重新打开一个。这次又遇上,是在不能忍,试着解决一下。

仔细观察会发现,在vi下切换文本“ctrl+w+w”时,很容易输入成”ctrl+s”。随便拿一个session试试就发现,果然是ctrl+s在作怪。只要输入这个,就会卡死。搜索了一下,发现果然是有原因的:

CTRL-S and CTRL-Q are called flow-control characters. They represent an antiquated way of stopping and restarting the flow of output from one device to another (e.g., from the computer to your terminal) that was useful when the speed of such output was low. They are rather obsolete in these days of high-speed networks. In fact, under the latter conditions, CTRL-S and CTRL-Q are basically a nuisance. The only thing you really need to know about them is that if your screen output becomes “stuck,” then you may have hit CTRL-S by accident. Type CTRL-Q to restart the output; any keys you may have hit in between will then take effect.
ctrl+s是一个古老的shell控制键,在输入ctrl+q就可以恢复了

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值