Linux 终端机的环境设定

可以利用 stty来查看和设定终端机的环境

stty -a

-a : 将目前所有的stty参数列出来

范例一:

列出所有的按键与按键内容

speed 38400 baud; rows 60; columns 158; 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; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts -cdtrdsr
-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

我们可以利用 stty -a 来列出目前环境中所有的按键列表,在上头的列表当中,需要注意的是特殊字体那几个, 此外,如果出现 ^ 表示 [Ctrl] 那个按键的意思。举例来说, intr = ^C 表示刟用 [ctrl] + c 来达成的。几个重要的代表意义是:

eof : End of file 癿意思,代表『结束输入』。
erase : 向后删除字符,
intr : 送出一个 interrupt (中断) 的讯号给目前正在 run 的程序;
kill : 初除在目前指令列上的所有文字;
quit : 送出一个 quit 的讯号给目前正在 run 的程序;
start : 在某个程序停止后,重新启动它的 output
stop : 停止目前屏带的输出;
susp : 送出一个 terminal stop 的讯号给正在 run 的程序。

猜你喜欢

转载自guoapeng.iteye.com/blog/1138068