Wednesday, 2 January 2013

Linux - read only statement while saving protected files in vi

What:

vi editor on Ubuntu operating system

Problem:

Read only statement prohibiting you from saving all your changes and therefore committing you to dumping them and trying again with sudo.

Solution:

Use the following command inside vi
:w !sudo tee %

You can also save your file into a temporary location
:wq /tmp/myfile

No comments:

Post a Comment