標籤:

在Bash中按Ctrl-S為什麼會失去響應?

我知道這是Bash的一個功能,而不是bug。

我也知道這個問題可以用Ctrl-Q來恢復。

可是我不明白這個feature在什麼情況下有用?


Ctrl+S 用於暫停屏幕刷新,一般用在屏幕大量信息不停刷新時暫停,比如tomcat運行時一直報錯,而人眼又看不清楚時。看完當前信息後可以使用Ctrl+Q恢復。經實測暫停期間程序將被阻斷


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.


沒有失去響應,只是bash停止回顯


跟BASH無關。 跟終端設置有關

[jw@localhost ~]$ stty -a

speed 38400 baud; rows 24; columns 80; line = 0;

intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;

swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;

lnext = ^V; flush = ^O; min = 1; time = 0;

-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts

-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff

-iuclc ixany imaxbel iutf8

opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0

isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt

echoctl echoke


推薦閱讀:

高性能 Web 緩存伺服器 nuster 1.7.9.5 發布
vim精簡版教程
有什麼理由選擇收費的RHEL而不用免費的Centos?
大型c++項目在linux下如何調試?

TAG:Linux | Unix | Bash |