LPIC-1 Exam 101 v5 (Linux Administrator) — Question 65
Which command must be entered before exiting vi to save the current file as filea.txt?
Answer options
- A. %s filea.txt
- B. %w filea.txt
- C. :save filea.txt
- D. :w filea.txt
- E. :s filea.txt
Correct answer: D
Explanation
The correct command to save the current file in vi is ':w filea.txt', which writes the changes to the specified file. The other options either do not exist in vi or do not perform the required save operation. For example, ':save' is not a valid command in vi.