Save file in vi using sudo

Posted . Visible to the public.

If you edit a file with vi as normal user, but need superuser rights to save it, you can use this sequence to save it using sudo:

:w !sudo tee %

/hat tip to @nistude Show archive.org snapshot

Matthias Marschall
Keywords
vim, linux
Posted by Matthias Marschall to Matthias Marschall (2011-08-10 16:07)