TTY 快捷键


快捷键 描述 注意事项
Ctrl+Shift+Backspace 删除行左 不适用于 Linux、Mac 和 Windows
Ctrl+Shift+Delete 删除行右 不适用于 Mac
Ctrl+C 触发 SIGINT 或关闭逐行读取实例
Ctrl+H 删除左边
Ctrl+D 如果当前行为空或 EOF,则向右删除或关闭逐行读取实例 不适用于 Windows
Ctrl+U 从当前位置删除到行首
Ctrl+K 从当前位置删除到行尾
Ctrl+Y Yank (Recall) 之前删除的文本 仅适用于由 Ctrl+UCtrl+K 删除的文本
Meta+Y 在之前删除的行之间循环 仅当最后一次击键为 Ctrl+Y 时可用
Ctrl+A 转到行首
Ctrl+E 跳到行尾
Ctrl+B 后退一个字符
Ctrl+F 前进一个字符
Ctrl+L 清屏
Ctrl+N 下一个历史子项
Ctrl+P 上一个历史子项
Ctrl+- 撤消之前的更改 任何发出键码 0x1F 的按键都会执行此操作。 在许多终端中,例如 xterm,this 绑定到 Ctrl+-
Ctrl+6 重做之前的更改 许多终端没有默认的重做按键。 我们选择键码 0x1E 来执行重做。 在 xterm 中,默认绑定到 Ctrl+6
Ctrl+Z 将正在运行的进程移到后台。 输入 fg 并按 回车键 返回。 不适用于 Windows
Ctrl+WCtrl +退格键 向后删除到单词边界 Ctrl+退格键 不适用于 Linux、Mac 和 Windows
Ctrl+Delete 向前删除到单词边界 不适用于 Mac
Ctrl+左箭头Meta+B 左边的单词 Ctrl+左箭头 不适用于 Mac
Ctrl+右箭头Meta+F 右边的单词 Ctrl+右箭头 不适用于 Mac
Meta+DMeta +删除键 删除右边的单词 Meta+删除键 不适用于 Windows
Meta+退格键 删除左边的单词 不适用于 Mac
Keybindings Description Notes
Ctrl+Shift+Backspace Delete line left Doesn't work on Linux, Mac and Windows
Ctrl+Shift+Delete Delete line right Doesn't work on Mac
Ctrl+C Emit SIGINT or close the readline instance
Ctrl+H Delete left
Ctrl+D Delete right or close the readline instance in case the current line is empty / EOF Doesn't work on Windows
Ctrl+U Delete from the current position to the line start
Ctrl+K Delete from the current position to the end of line
Ctrl+Y Yank (Recall) the previously deleted text Only works with text deleted by Ctrl+U or Ctrl+K
Meta+Y Cycle among previously deleted lines Only available when the last keystroke is Ctrl+Y
Ctrl+A Go to start of line
Ctrl+E Go to end of line
Ctrl+B Back one character
Ctrl+F Forward one character
Ctrl+L Clear screen
Ctrl+N Next history item
Ctrl+P Previous history item
Ctrl+- Undo previous change Any keystroke that emits key code 0x1F will do this action. In many terminals, for example xterm, this is bound to Ctrl+-.
Ctrl+6 Redo previous change Many terminals don't have a default redo keystroke. We choose key code 0x1E to perform redo. In xterm, it is bound to Ctrl+6 by default.
Ctrl+Z Moves running process into background. Type fg and press Enter to return. Doesn't work on Windows
Ctrl+W or Ctrl +Backspace Delete backward to a word boundary Ctrl+Backspace Doesn't work on Linux, Mac and Windows
Ctrl+Delete Delete forward to a word boundary Doesn't work on Mac
Ctrl+Left arrow or Meta+B Word left Ctrl+Left arrow Doesn't work on Mac
Ctrl+Right arrow or Meta+F Word right Ctrl+Right arrow Doesn't work on Mac
Meta+D or Meta +Delete Delete word right Meta+Delete Doesn't work on windows
Meta+Backspace Delete word left Doesn't work on Mac