1. 程式人生 > >CTRL+C CTRL+D CTRL+Z CTRL+Q CTRL+S CTRL+L 區別

CTRL+C CTRL+D CTRL+Z CTRL+Q CTRL+S CTRL+L 區別

CTRL+C 終止fg中的程式
CTRL+D 結束input
CTRL+Z 將fg程式放入bg並且將狀態設定為stopped
CTRL+Q 在終端輸入ctrl+q 以後再輸入的東西將不會顯示 直到你按CTRL+S
CTRL+S
CTRL+L 有點像clear

這個跟fg bg jobs kill 有點關係  屬於當前bash下的job control. 

放入bg的程式會在當前bash結束後自動結束, 可以用nohup 指令& 或者nohup 指令來讓指令不受當前的bash影響, 即為結束當前terminal後程序仍然可以執行

輸入命令stty -a 可以看到所有當前的控制命令


[email protected]:/tmp# stty -a
speed 38400 baud; rows 61; columns 207; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar 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 -flusho -extproc