Skip to content
Go back

Retroactive sudo

Published:  at  10:23 AM
1 min read

It happened to me countless times - forgetting to sudo before I start editing a file I don’t have permission on using Vim.

I used to save the edited file to a temporary location when the permission error prompt, and copy it back again.

Today I Learned this awesome command:

:w !sudo tee %

Command Explained

:w !sudo tee % will pipe the contents of the buffer through sudo tee FILENAME.

HACKERMAN



Previous Post
TLDR Pages
Next Post
Wait, Why?