Learning the vi Editor

Learning the vi EditorSearch this book
Previous: A.2 Editing CommandsAppendix A
Quick Reference
Next: A.4 Command Line Options
 

A.3 Exit Commands

ZZWrite (save) and quit file
:xWrite (save) and quit file
:wqWrite (save) and quit file
:wWrite (save) file
:w!Write (save) file (overriding protection)
:30,60w newfileWrite from line 30 through line 60 as newfile
:30,60w>> file

Write from line 30 through line 60 and append to file

:w %.newWrite current buffer named file as file.new
:qQuit file
:q!Quit file (overriding protection)
QQuit vi and invoke ex
:e file2Edit file2 without leaving vi
:nEdit next file
:e!Return to version of current file at time of last write (save)
:e#Edit alternate file
%Current filename
#Alternate filename


Previous: A.2 Editing CommandsLearning the vi EditorNext: A.4 Command Line Options
A.2 Editing CommandsBook IndexA.4 Command Line Options

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System