Exam 702-100 Topic 5 Question 39 Discussion
Actual exam question for Lpi's 702-100 exam
Question #: 39
Topic #: 5
Question #: 39
Topic #: 5
While using vi as superuser. the attempt to save a file while quitting the editor leads to an error indicating that the file is read-only. How can the file permissions be overridden to save the edits to the file and quit the editor?
Suggested Answer: E Vote an answer
Explanation
The wq! command is used to save a file and quit the vi editor, even if the file is read-only. The w command means write, the q command means quit, and the ! command means force. By combining these commands, the vi editor will override the file permissions and save the changes to the file, then exit the editor. The other options are either invalid syntax or do not force the write operation. For example, wq will save and quit only if the file is writable, ql will quit without saving, and fw! will force write but not quit. References:
[vi] - FreeBSD vi(1) Manual Page
[wq!] - How to save a file in vi / vim editor in Linux / Unix
The wq! command is used to save a file and quit the vi editor, even if the file is read-only. The w command means write, the q command means quit, and the ! command means force. By combining these commands, the vi editor will override the file permissions and save the changes to the file, then exit the editor. The other options are either invalid syntax or do not force the write operation. For example, wq will save and quit only if the file is writable, ql will quit without saving, and fw! will force write but not quit. References:
[vi] - FreeBSD vi(1) Manual Page
[wq!] - How to save a file in vi / vim editor in Linux / Unix
by Freda at Feb 20, 2026, 10:47 PM
0
0
0
10
Comments
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Report Comment
Commenting
You can sign-up / login (it's free).