Bash快捷键速查 (双语对照)

Ctrl-a

Move to the start of the line.

移动到行首

Ctrl-e

Move to the end of the line.

移动到行尾

Ctrl-b

Move back one character.

向前移动一个字符

Alt-b

Move back one word.

向前移动一个单词

Ctrl-f

Move forward one character.

向后移动一个字符

Alt-f

Move forward one word.

向后移动一个单词

Ctrl-] x

Where x is any character, moves the cursor forward to the next
occurrence of x.

“x”代表任意字符,向后移动光标至下一次字符“x”出现的地方

Alt-Ctrl-] x

Where x is any character, moves the cursor backwards to the
previous occurrence of x.

“x”代表任意字符,向后移动光标至上一次字符“x”出现的地方

Ctrl-u

Delete from the cursor to the beginning of the line.

删除自光标前一字符至行首的字符

Ctrl-k

Delete from the cursor to the end of the line.

删除自光标所在字符至行尾的字符

Ctrl-w

Delete from the cursor to the start of the word.

删除自光标前一字符至该单词开头的字符

Ctrl-y

Pastes text from the clipboard.

从剪切版粘贴文本

Ctrl-l

Clear the screen leaving the current line at the top of the screen.

清屏,使当前行位于屏幕最顶端

Ctrl-x Ctrl-u

Undo the last changes. Ctrl-_ does the same

撤消前一次变更,Ctrl+_与之相同。

Alt-r

Undo all changes to the line.

撤消此前对该行的所有变更

Alt-Ctrl-e

Expand command line.

展开某一命令

Ctrl-r

Incremental reverse search of history.

增量反向搜索历史

Alt-p

Non-incremental reverse search of history.

非增量反向搜索历史

!!

Execute last command in history

执行上一条历史命令

!abc

Execute last command in history beginning with abc

执行最近一条以abc开头的历史命令

!abc:p

Print last command in history beginning with abc

显示最近一条以abc开头的历史命令

!n

Execute nth command in history

执行第n条历史命令

!$

Last argument of last command

前一次命令的参数

!^

First argument of last command

前一次命令的第一个参数

^abc^xyz

Replace first occurrence of abc with xyz in last command and execute it

替换前一次命令中字符“abc”出现的第一处为“xyz”并执行

 

参考链接: Bash Shortcuts Quick Reference

One Comment

发表评论