Linux_FoundationLinux_Foundation
LFCA · Question #21
LFCA Question #21: Real Exam Question with Answer & Explanation
The correct answer is A: :q!. The vi/vim editor uses specific commands to perform actions like exiting, saving, or quitting without saving. To exit the editor without saving any changes, the correct command is :q!.
Submitted by fatima_kr· May 4, 2026Linux Fundamentals
Question
When using vi or vim to edit a file, how do you exit without saving?
Options
- A:q!
- BZZ
- C:wq!
- D:exit
Explanation
The vi/vim editor uses specific commands to perform actions like exiting, saving, or quitting without saving. To exit the editor without saving any changes, the correct command is :q!.
Common mistakes.
- B. The
ZZcommand is used to save the file and then quit the vi/vim editor. - C. The
:wq!command is used to write (save) the file and then quit the vi/vim editor, forcing the write if the file is read-only. - D. The
:exitcommand is not a standard vi/vim command for quitting; it might be recognized as an alias in some shell environments but not directly within vi/vim for this purpose.
Concept tested. vi/vim editor commands
Topics
#vi/vim#Text Editing#Command Mode#File Operations
Community Discussion
No community discussion yet for this question.