Chinaunix首页 | 论坛 | 博客
  • 博客访问: 19732546
  • 博文数量: 679
  • 博客积分: 10495
  • 博客等级: 上将
  • 技术积分: 9308
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-18 10:51
文章分类

全部博文(679)

文章存档

2012年(5)

2011年(38)

2010年(86)

2009年(145)

2008年(170)

2007年(165)

2006年(89)

分类:

2008-08-21 16:40:40

Linux shell 快捷键

磁针石

联系方式: gmail and gtalk: xurongzhong#gmail.com

 

参考资料

*《学习bash shell 3版》1.9. Special Characters and Quoting

*《学习bash shell 3版》2.3. emacs Editing Mode

主要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)

 

       如果你的unix来源于BSD (such as SunOS and OS X),可以使用stty all查看键盘设置;如果来源于System III or System V (this includes AIX, HP/UX, SCO, Linux, and Xenix), 使用tty –a

 

命令行快捷键-emacs编辑模式

       可以把emacs编辑模式当作emacs中单一,一行的窗口。可以使用光标移动,复制粘贴,查找等操作。

 

基本的控制键:

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的同时再先后按xu,撤销刚才的操作

 

基本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-.

 

参考:

 

stty参考见:

 

阅读(9230) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~