Skip to main content
Linux AdministrationMediumMultiple Choice

Linux Administration Question

Statement

Which of the following sequences in the vi editor saves the opened document and exits the editor? (Choose TWO correct answers.)

#vi#zz#wq#save#exit
A

esc ZZ

Correct
B

ctrl :w!

C

esc zz

D

esc :wq!

Correct
E

ctrl XX

Resolution & Explanations

In vi, ZZ in command mode is a quick shortcut to save and quit. The sequence :wq (Write and Quit) is the standard ex-mode command to perform the same action. wq! ensures the save even if the file has read-only permissions (provided the user has ownership/rights).