歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> linux stty命令學習

linux stty命令學習

日期:2017/3/1 14:42:33   编辑:關於Linux
linux stty命令學習 stty命令用來修改和顯示終端行設置。 sh-# stty speed 115200 baud; line = 0; kill = ^X; -brkint ixany -imaxbel -iexten -echoe echoprt sh-# stty -a speed 115200 baud; rows 0; columns 0; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^X; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 1; -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 CTRL+S,用來stop當前的shell; CTRL+Q,用來start當前的shell; CTRL+Z,用來suspend當前的shell; CTRL+C,用來interrupt當前執行的程序; ... 這樣我們終於知道了為什麼在shell下鍵入組合鍵CTRL+C,CTRL+D,CTRL+Z會有對應的處理了。 原來是shell在運行時,它已經接管了對這些按鍵的處理了。 sh-# ps PID TTY TIME CMD 409 ? 00:00:00 init 943 ? 00:00:00 sh 1213 ? 00:00:00 sh 4918 ? 00:00:00 ps sh-# kill -2 943 sh-# 這裡我們測試了一下給當前shell發送SIGINT signal,由於當前shell下沒有運行任何命令或程序, 所以看起來什麼都沒做。 你也可以在shell下按組合鍵CTRL+C來看看,沒錯,CTRL+C實際上就是給當前shell發送SIGINT, 它們倆是等效的。 待解決問題:當我的終端類型為/dev/console時,在shell下按CTRL+S/CTRL+Q等組合鍵沒有作用; sh-# tty /dev/console 但是當我的終端類型為/dev/pts/6時在shell下按CTRL+S/CTRL+Q會產生作用; sh-# tty /dev/pts/6
Copyright © Linux教程網 All Rights Reserved