19.5k views
1 vote
You have been working on a long vi text file and now you've got to rush off to a meeting. How can you quickly save your work and exit the vi editor?

1) Press ESC followed by :wq
2) Press Ctrl + C
3) Press Ctrl + Z
4) Press Ctrl + X

1 Answer

3 votes

Final answer:

To quickly save and exit the vi editor, press ESC to switch to normal mode, type :wq to save changes and quit, and then press Enter.

Step-by-step explanation:

To quickly save your work and exit the vi editor, you should follow these steps:

  1. Press the ESC key to ensure you are in normal mode.
  2. Type :wq to write the changes to the file (save) and quit.
  3. Press Enter to execute the command.

Just pressing Ctrl + C, Ctrl + Z, or Ctrl + X will not save your changes and quit vi. Ctrl + C will cancel any running command inside vi, Ctrl + Z will suspend vi, and Ctrl + X doesn't have a default action in vi that saves and exits.

User Superselector
by
7.6k points