up previous next contents
Next: Deleting Text With "vi" Up: The UNIX Editor - Previous: Command Description   Contents

Exercise: Inserting Text With "vi"

The following exercise shows you how to open a file, enter text, and then save the changes to the file.

Step #1 At the command line, type "vi doc1".

Step #2 Type the letter "i".  This puts you into insert mode.

Step #3 Enter the following text into your document:

  This is my first vi document.
  This is the second line of the document.

Step #4 Hit the "<Esc>" key.  This takes you back into command mode.

Step #5 Now enter ":wq" to save the changes to the file.  This stands for "write and quit".  You are returned to the UNIX command line.


up previous next contents
Next: Deleting Text With "vi" Up: The UNIX Editor - Previous: Command Description   Contents