Unix Shell -- VI

Vi command:

x/X: delete current charactor

ctrl+u: cancel the last operation

ctrl+F/B: go to the page top/bottom

k/l: move

dd: delete the current line

+: go to the next line

E/e: go to the next phrase(word)

D/d: delete to the end of line(eol)

q!: quit without saving

wq: save and quit

ZZ: save and quit

ZX: quit without saving

n: next occurence

%\x\y\g replace 'x' with 'y' in file

vi -r <filename>: recover the file(last time exit without saving)

{/}: go to the beginning or end of the paragraph

&: make the program(command) run in background, if you use this command, you will get a processid,
so you can view the status of the program(command) by using 'fg processid' which brings it go foreground.

/yourstring: find yourstring in the file, then you can user 'n' to go to the next occurence of the searching.


--------------------------------------------------------------------------
½â¾ö vi±à¼­Ê±Òì³£Í˳öºóµÄÌáʾ
2009Äê03ÔÂ19ÈÕ ÐÇÆÚËÄ ÏÂÎç 04:48
E325: ATTENTION
Found a swap file by the name "filename.swp"
          owned by: root   dated: Wed Mar 18 10:58:30 2009
         file name: /han/ok.sh
          modified: no
         user name: root   host name: localhost.localdomain
        process ID: 28676 (still running)
While opening file "ok.sh"
             dated: Wed Mar 18 10:56:50 2009

(1) Another program may be editing the same file.
    If this is the case, be careful not to end up with two
    different instances of the same file when making changes.
    Quit, or continue with caution.

(2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r ok.sh"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file ".ok.sh.swp"
    to avoid this message.
"ok.sh" 4L, 57C
Hit ENTER or type command to continue

ÕâÊÇÓÉÓÚÔڱ༭¸ÃÎļþµÄʱºòÒì³£Í˳öÁË£¬ÒòΪviÔڱ༭Îļþʱ»á´´½¨Ò»¸ö½»»»Îļþswap fileÒÔ±£Ö¤ÎļþµÄ°²È«ÐÔ

µ±ÏµÍ³ÖØÆôºóvi ÌáʾÎÒÃÇÊÇ·ñ»Ö¸´ÒÔÇ°µÄÎļþ¡£Èç¹ûÐèÒª»Ö¸´£¬¿ÉÒÔÀûÓÃvi -r filename.swap ---->> È»ºó´òðºÅ½øÈëÃüÁîģʽ£¬write newfilenameÒÔÁí´æ½»»»Îļþ¡£


È¥µôÉÏÃæµÄÌáʾ£ºÎÒÃÇÐèҪɾ³ý¸ÃswapÎļþ£ºrm -f filename.swap
 



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值