:w !sudo tee %
Have you ever been editing a file in vi or vim and found out that you cannot save it due to permissions? Yea, me too. Ugh! The shortcut above utilizes your sudo permissions to hand off the write to tee so that it can be saved out of vi or vim.
Rejoice! Of course this requires that you have at least sudo permissions to edit the file. Sorry hackers!
No comments:
Post a Comment