Friday, October 23, 2009

save file in vi when you forget 'sudo'

:w !sudo tee %

This issue happened to me a lot of times.
After you made some changes in vi and want to save, suddenly you find you don't have the permission~.

> file.txt
empty the file (or create a new empty file)

place the argument of most recent command (keep pressing for older ones)

-- from

No comments:

Post a Comment