与 Ctrl+k 相反的键盘快捷键是什么?

与 Ctrl+k 相反的键盘快捷键是什么?

Ctrl+K删除 UNIX 命令行中的剩余行。如何删除所有文字光标?

答案1

使用Ctrl+ u

bash文档来看,杀戮与强行掠夺:

unix 行丢弃 (Cu)

从光标处向后杀到当前行的开头。

Ctrl+u行为不仅由具有自己的行编辑器(如bashzshtcshsh -o emacs)的 shell 控制,而且还由处于规范模式时终端驱动程序的行规则(如 中或在未启用行编辑器时/cat的基本实现)控制)。因此它在任何地方都有效。shksh

stty -a您可以使用(或stty -everything在 BSD 系统中)检查终端驱动程序的线路规则:

$ 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
-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

相关内容