控制字符都是可以用(stty命令)更改的。
用stty -a看看终端配置。
[loong@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 -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
ctrl-c 是发送 SIGINT 信号,终止一个进程
ctrl-z 是发送 SIGSTOP信号,挂起一个进程
ctrl-d 不是发送信号,而是表示一个特殊的二进制值,表示 EOF
但是ctrl-d在具体比如getchar应用中又有些特别之处,可以参考"getchar()和EOF"那篇文章
本文详细介绍了在终端中使用的各种控制字符及其功能,如Ctrl-C用于发送SIGINT信号来终止进程,Ctrl-Z用于发送SIGSTOP信号挂起进程,以及Ctrl-D在不同场景中的特殊用途。同时展示了如何使用stty命令查看和修改这些设置。

6317

被折叠的 条评论
为什么被折叠?



