笔记来自OReilly - Learning the vi Editor
quit and save is ZZ
退出并且保存
w save your file but not quit
保存文件但不退出
q to quit if you haven’t made any edits
当你没做任何编辑时退出
wq both save your edits and quit (:wq is equivalent to ZZ)
保存文件同时退出
e:! RETURN if you want to wipe out of all of the edits you have made in a session and return to the original file
如果你想要回到原文件并且清除所有在当前会话中所做的编辑
:q! RETURN you want to wipe out your edits and then just quit vi
(the exclamation point added to the :e or :q command causes vi to override this prohibition,performing the operation even though the buffer has been modified)
清除编辑及退出编辑器
(感叹号!使编辑器忽略警告,即使缓冲区被修改了也继续操作)
:w! file to overwrite the existing file,or type :w newfile to save the edited version in a new file
重写已存在的文件 将正在编辑的版本保存为新文件
type :!rm junkfile to delete a (large) unneeded file and free some space
删除(大量的)不必要的文件以及清理空间
:!df to see whether there’s any space on another file system .if there is ,choose a directory and write your file to it with :W pathname(df is the UNIX command to check a disk’s free space)
查找哪儿有剩余空间,如果存在,选择目录然后将文件写入(df在UNIX中用来查看磁盘剩余空间)
:!ls /tmp to see whther there any files you can remove to gain some disk space
查看是否有磁盘空间提供给你来移动文件
you can create a shell by typing :sh
你可以开启一个shell通过输入
type CTRL-D or exit to terminate the shell and return to vi
输入。。。。。。。。。来结束shell并返回vi
…then write your file with :w!
。。。然后开始编辑你的文档
附练习图: