How to Save and Quit from vi

The most current version as of .

When you are editing in vi and want to save and quit make sure to follow the below steps:

  1. Press esc to exit from editing mode and enter command mode
  2. Enter :wq

Here w writes the contents and q will then quite vi.

That’s it.

— David Wolf