主要unix支持的控制键
Control key | stty name | Function description |
CTRL-C | intr | 删除整行 |
CTRL-D | eof | End of input |
CTRL-\ | quit | Stop current command if CTRL-C doesn't work |
CTRL-S | stop | Halt output to screen |
CTRL-Q |
| Restart output to screen |
DEL or CTRL-? | erase | Erase last character |
CTRL-U | kill | 删除光标之前到行首的字符 |
CTRL-Z | susp | Suspend current command (see Chapter 8) |
基本的控制键:
Command | Description |
CTRL-B | 光标往回(Backward)移动一个字符位置 |
CTRL-F | 光标向前(Forward)移动一个字符位置 |
DEL | Delete one character backward |
CTRL-D | Delete one character forward |
Ctrl + w | 删除从光标位置前到当前所处单词(Word)的开头 |
Ctrl + x | 在行首和当前光标处切换 |
Ctrl+v | 插入特殊字符,如Ctrl+v+Tab加入Tab字符键 |
Esc+t | 颠倒光标所在处及其相邻单词的位置 |
Ctrl+(x u) | 按住Ctrl的同时再先后按x和u,撤销刚才的操作 |
基本word命令
Command | Description |
ESC-B | 光标向前(Forward)移动到下一个单词 |
ESC-F | 光标往回(Backward)移动到前一个单词 |
ESC-DEL | Kill one word backward |
ESC-CTRL-H | 同上,这个命令太麻烦,不建议使用 |
ESC-D | Kill one word forward |
CTRL-Y | 粘贴最后一次被删除的单词 |
行编辑命令:
Command | Description |
CTRL-A | 移动到当前行的开头 |
CTRL-E | 移动到当前行的结尾 |
CTRL-K | 剪切命令行中光标所在处之后的所有字符(包括自身) |
历史命令
Command | Description |
CTRL-P | 调出命令历史中的前一条(Previous)命令,相当于通常的上箭头 |
CTRL-N | 调出命令历史中的下一条(Next)命令,相当于通常的上箭头 |
CTRL-R | 显示:号提示,根据用户输入查找相关历史命令(reverse-i-search) |
ESC-< | 历史列表第一项 |
ESC-> | 历史列表最后一项 |
按CTRL-R 2次,会重复上次的查找。
文本完成命令
Command | Description |
TAB | Attempt to perform general completion of the text |
ESC-? | List the possible completions |
ESC-/ | Attempt filename completion |
CTRL-X / | List the possible filename completions |
ESC-~ | Attempt username completion |
CTRL-X ~ | List the possible username completions |
ESC-$ | Attempt variable completion |
CTRL-X $ | List the possible variable completions |
ESC-@ | Attempt hostname completion |
CTRL-X @ | List the possible hostname completions |
ESC-! | Attempt command completion |
CTRL-X ! | List the possible command completions |
ESC-TAB | Attempt completion from previous commands in the history list |
杂项命令:
Command | Description |
CTRL-J | Same as RETURN |
CTRL-L | 清屏 |
CTRL-M | Same as RETURN |
CTRL-O | 回车并显示下一条命令 |
CTRL-T | Transpose two characters on either side of point and move point forward by one |
CTRL-U | Kills the line from the beginning to point |
CTRL-V | Quoted insert |
CTRL-[ | Same as ESC (most keyboards) |
ESC-C | Capitalize word after point |
ESC-U | Change word after point to all capital letters |
ESC-L | Change word after point to all lowercase letters |
ESC-. | Insert last word in previous command line after point |
ESC-_ | Same as ESC-. |