Vim Save File You Didn't Sudo Edit -

This is post is now quite old and the the information it contains may be out of date or innacurate.

If you find any errors or have any suggestions to update the information please let us know or create a pull request on GitHub

How many times have you edited a file in Vim, made your changes and then realised you don’t have write permissions when it comes to save it.

Well if you do it again, this tip is for you. You CAN save the file using this command:

:w !sudo tee %

Lifesaver!

This one direct from one of my personal favourite sites, Command Line Fu


Tags: sudopermissionssavevimreadonlywrite