vi保存和退出

来源:互联网 发布:netfits云墙 mac 编辑:程序博客网 时间:2024/05/18 02:11
You can quit working on a file at any time, save your edits, and return to the Unix
prompt. The vi command to quit and save edits is ZZ. Note that ZZ is capitalized.
Let’s assume that you do create a file called practice to practice vi commands, and
that you type in six lines of text. To save the file, first check that you are in command

mode by pressing ESC , and then enter ZZ.

 KeystrokesResultsZZ   "practice" [New file] 6 lines, 320 characters
Give the write and save command, ZZ. Your file is saved as a regular Unix file.lsch01 ch02 practice
Listing the files in the directory shows the new file practice that you created.

You can also save your edits with ex commands. Type :w to save (write) your file but
not quit vi; type :q to quit if you haven’t made any edits; and type :wq to both save
your edits and quit. (:wq is equivalent to ZZ.) 

0 0
原创粉丝点击