Linux下ctrl+s假死恢复

来源:互联网 发布:科比公司 知乎 编辑:程序博客网 时间:2024/05/18 14:22

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

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

后来发现只要数据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.

SecureCRT作为著名的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 0