QuestionQ11

Basic Unix Skills

While using vi as the superuser, saving a file while exiting the editor produces an error that the file is read-only. How can the file permissions be overridden so the edits are saved and the editor is exited?

  • A :fw!
  • B :fwq
  • C :q!
  • D :wq
  • E :wq!
Explanation

In vi, :wq! forces the file write despite the editor's read-only warning and then quits. As superuser, the underlying operating-system permissions allow the forced write to succeed.

Community Discussion

No comments yet. Be the first to start the discussion!