Figure 4.16. Use :q! to quit vi without saving changes.
To Exit vi:
Enter command mode with q, then type :q to quit vi. If you haven't saved your latest changes, vi will not quit and will tell you to use ! to override. To quit without saving your changes, use :q!, as shown in Figure 4.16.
If you don't really want to quit but want to edit a different file instead, type :e filename to open a new file to edit.
We recommend that you take a few minutes and try out some of the commands that you'll use throughout your vi experience. If you don't think you'll be needing this range of commands, consider using pico rather than vi.
It takes some practice to get accustomed to vi, but the time spent is well worth it. With patience and practice, you'll quickly become proficient in using vi. Take your time, take deep breaths, and plow ahead.