nerdexam
Linux_Foundation

LFCS · Question #785

An administrator is writing text in vi. Now the administrator wants to save their changes and exit. Which of the following sequence of inputs will accomplish this? (Select TWO).

The correct answer is A. esc ZZ D. esc :wq! To save changes and exit in the vi editor, an administrator can use either the esc ZZ shortcut or the command-line mode sequence esc :wq!.

Submitted by emma.c· Apr 18, 2026Essential Commands

Question

An administrator is writing text in vi. Now the administrator wants to save their changes and exit. Which of the following sequence of inputs will accomplish this? (Select TWO).

Options

  • Aesc ZZ
  • Bctrl :w!
  • Cesc zz
  • Desc :wq!
  • Ectrl XX

How the community answered

(16 responses)
  • A
    94% (15)
  • C
    6% (1)

Why each option

To save changes and exit in the vi editor, an administrator can use either the `esc ZZ` shortcut or the command-line mode sequence `esc :wq!`.

Aesc ZZCorrect

The `esc ZZ` sequence is a quick command in vi that saves any changes made to the file and then quits the editor.

Bctrl :w!

`ctrl :w!` is incorrect because the colon (`:`) command is initiated after pressing `esc`, not `ctrl`.

Cesc zz

`esc zz` is not a standard vi command for saving and exiting; the correct sequence uses uppercase 'Z' (`ZZ`).

Desc :wq!Correct

The `esc :wq!` command switches to vi's command-line mode, then writes (saves) the file forcefully (`w!`) and quits (`q`), successfully saving changes and exiting.

Ectrl XX

`ctrl XX` is not a recognized vi command for saving and exiting the editor.

Concept tested: vi editor save and exit commands

Source: https://man7.org/linux/man-pages/man1/vi.1.html

Topics

#vi editor#vim editor#save and exit#editor commands

Community Discussion

No community discussion yet for this question.

Full LFCS Practice