2016-09-13 25 views
-1

問題:CTRL +ü不會殺我的終端程序。^U未殺,儘管stty的聲稱


細節:這裏是我的結果從ssty --all

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 

正如你所看到的,它描述了可用信號中斷:
^C = 不及物動詞
^\ = 退出
爲^ U =
等等

這裏是一個無限運行程序:

int main(){while(true){}} 

CTRL +ç工作

$./main                
^C 
$ 

CTRL +\工作

$./main               
^\[1] 6331 quit (core dumped) ./main 
$ 

CTRL +ü工作。
爲什麼我不能用這種方式殺死終端程序?

我當然可以找到進程ID並運行kill -9 <PID>,
但我想要簡寫工作。


我在Ubuntu:

lsb_release --all 
No LSB modules are available. 
Distributor ID: Ubuntu 
Description: Ubuntu 14.04.5 LTS 
Release: 14.04 
Codename: trusty 

這裏是我的終端規格,但我試過其他終端(可能不相關)

gnome-terminal --version           
GNOME Terminal 3.6.2 

它沒也不適用於xterm。我也嘗試過不同的炮彈:
shbash,ans zsh

問題是什麼?我現在應該看什麼?

回答

1

的輸出指的是殺線字符,即將^U刪除到該行的開頭。

是發送一箇中斷信號的字符爲intrquitsusp,並在某些系統(不是在Linux上IIRC),dsusp

+0

我明白了。那麼除了使用'kill'之外,沒有辦法殺死它? –

+0

嗯,總是有sysrq鍵(https://en.wikipedia.org/wiki/Magic_SysRq_key),但是會殺死當前虛擬終端上的每個進程,或者每個進程,除了init。 – ninjalj