Save a file even when you forget sudo

Saturday, December 3, 2016


If you forget to open a file in vim a sudo/root, you can simply do in vim (sudo needs to be installed):

      :w !sudo tee %


If you find any issue or have any question about this article, feel free to reach out to me via email, mastodon, matrix or even IRC, see the About Me page for details.

See Also

Adding a default «vhost» to nginx

Sshfs cheatsheet