切到命令行开始|结尾
Ctrl + A – Go to the beginning of the line you are currently typing on
Ctrl + E – Go to the end of the line you are currently typing on
清屏,类似于 clear 命令
Ctrl + L – Clears the Screen, similar to the clear command
清除光标以前
Ctrl + U – Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
退格键 backspace
Ctrl + H – Same as backspace
从命令历史中找
Ctrl + R – Let’s you search through previously used commands
终止命令
Ctrl + C – Kill whatever you are running
退出 shell
Ctrl + D – Exit the current shell
??
Ctrl + Z – Puts whatever you are running into a suspended background process. fg restores it.
清除光标之前
Ctrl + W – Delete the word before the cursor
清除光标之后
Ctrl + K – Clear the line after the cursor
切换光标前最后两个字母(单词)
Ctrl + T – Swap the last two characters before the cursor
Esc + T – Swap the last two words before the cursor
??在 ubuntu x windows终端中会切换到菜单!tty 可能可以
Alt + F – Move cursor forward one word on the current line
Alt + B – Move cursor backward one word on the current line
自动补全
Tab – Auto-complete files and folder names
粘贴(刚才 ctrl+w 或者 ctrl+k 的内容)
Ctrl + Y – to paste it (as in delete and copy) all text in front of the cursor
??
Esc + . (or Esc + Underscore) – Insert Last Argument
向前|后移动一个字母
Ctrl + b – Move back a character
Ctrl + f – Move forward a character
??
Ctrl + r – Search the history backwards
光标在当前位置和 EOL 之间切换(EOL end of line?但我实验,是在开头和当前位置之间切换,怎么理解?谁知道?)
Ctrl + xx – Move between EOL and current cursor position
Ctrl + x @ – Show possible hostname completions
Alt +
Alt + > – Move to the last line in the history
Alt + ? – Show current completion list
Alt + * – Insert all possible completions
Alt + / – Attempt to complete filename
Alt + . – Yank last argument to previous command
Alt + c – Capitalize the word
Alt + d – Delete word
Alt + l – Make word lowercase
Alt + n – Search the history forwards non-incremental
Alt + p – Search the history backwards non-incremental
Alt + r – Recall command
Alt + t – Move words around
Alt + u – Make word uppercase
Alt + back-space – Delete backward from cursor
Here “2T” means Press TAB twice
$ 2T – All available commands(common)
$ (string) 2T – All available commands starting with (string)
==============================================================
删除
ctrl + d 删除光标所在位置上的字符相当于VIM里x或者dl
ctrl + h 删除光标所在位置前的字符相当于VIM里hx或者dh
ctrl + k 删除光标后面所有字符相当于VIM里d shift+$
ctrl + u 删除光标前面所有字符相当于VIM里d shift+^
ctrl + w 删除光标前一个单词相当于VIM里db
ctrl + y 恢复ctrl+u上次执行时删除的字符
ctrl + ? 撤消前一次输入
alt + r 撤消前一次动作
alt + d 删除光标所在位置的后单词
移动
ctrl + a 将光标移动到命令行开头相当于VIM里shift+^
ctrl + e 将光标移动到命令行结尾处相当于VIM里shift+$
ctrl + f 光标向后移动一个字符相当于VIM里l
ctrl + b 光标向前移动一个字符相当于VIM里h
ctrl + 方向键左键 光标移动到前一个单词开头
ctrl + 方向键右键 光标移动到后一个单词结尾
ctrl + x 在上次光标所在字符和当前光标所在字符之间跳转
alt + f 跳到光标所在位置单词尾部
替换
ctrl + t 将光标当前字符与前面一个字符替换
alt + t 交换两个光标当前所处位置单词和光标前一个单词
alt + u 把光标当前位置单词变为大写
alt + l 把光标当前位置单词变为小写
alt + c 把光标当前位置单词头一个字母变为大写
^oldstr^newstr 替换前一次命令中字符串
历史命令编辑
ctrl + p 返回上一次输入命令字符
ctrl + r 输入单词搜索历史命令
alt + p 输入字符查找与字符相接近的历史命令
alt + > 返回上一次执行命令
其它
ctrl + s 锁住终端
ctrl + q 解锁终端
ctrl + l 清屏相当于命令clear
ctrl + c 另起一行
ctrl + i 类似TAB健补全功能
ctrl + o 重复执行命令
相关日志shell grep 查找进程的小技巧
Linux ar 命令
Could not open device at /dev/ipmi0
rndc-confgen 没有反应
/dev/random 与 /dev/urandom
转载请注明:爱开源 » linux shell快捷键