Skip to content

Instantly share code, notes, and snippets.

@php-cpm
Last active March 1, 2019 02:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save php-cpm/52929a078a9603b1c6c84d8f65dd79ae to your computer and use it in GitHub Desktop.
Save php-cpm/52929a078a9603b1c6c84d8f65dd79ae to your computer and use it in GitHub Desktop.
终端快捷键

日常在图形化界面下操作,记住的快捷键并不能很好的与终端(shell、命令行,怎么叫都行)配合使用,需要额外记忆。

在终端下,你常常只有一行可以输入命令的空间,所以要记住的快捷键主要是用来处理光标在输入命令的位置和调整内容的。

快捷键 单词速记 用途
Ctrl+Shift+C 复制,进入复制模式,按 空格 开始选择,选择完毕后再按一次 Ctrl+Shift+C 退出
Ctrl+Shift+V 粘贴
Ctrl + A、Home A 是首字母 光标跳到行首
Ctrl + E、End End 光标跳到行尾
Ctrl + B、← backward 光标向左(向后)移动,输入方向是前
Ctrl + F、→ forward 光标向右(向前)移动,输入方向是前
Ctrl + ← 、Alt + B、先后按 Esc 和 B backward 光标向左(向后)移动,一次移动一个单词
Ctrl + → 、Alt + F、先后按 Esc 和 F forward 光标向右(向前)移动,一次移动一个单词
Ctrl + R reverse 出现命令历史记录搜索提示,输入字符后会自动匹配命令
Ctrl + P previous 向上翻以前的输入命令,相当于向上方向键
Ctrl + N next 向下翻以前的输入命令,相当于向下方向键
Ctrl + W word 从光标位置向后删除一个字
Ctrl + Y yank 粘贴最后一个删除的字
Ctrl + D delete 删除当前光标位置的一个字符
Ctrl + U unix-line-discard 从光标当前位置删除所有字符至行首
Ctrl + K kill-line 从光标当前位置删除所有字符至行尾
Ctrl + C、Ctrl + D、Ctrl + Z cancel、 down、Z 是最后一个字母表示结束 结束任务
!! 执行上一个命令
!top 执行上一个跟 top 有关的命令
!top:p 列出上一个跟 top 有关的命令
!$ 执行上一个命令的最后一段
!* 显示上一个命令的最后一段

参考: https://www.tecmint.com/linux-command-line-bash-shortcut-keys/ https://stackoverflow.com/questions/4415598/what-does-u-stand-for-in-ctrlu https://unix.stackexchange.com/questions/154228/what-is-the-keyboard-shortcut-opposite-to-ctrlk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment