4 ms·
Not really a unix command, but a vi command that has been really useful, specially if you do lots of editing protected files and want to keep your custom vim co
by overgun77 14y ago
Not really a unix command, but a vi command that has been really useful, specially if you do lots of editing protected files and want to keep your custom vim configuration:
!sudo tee %
- ralph 14y agoWhat vi mode is that entered in?
- emillon 14y agoNormal mode (:help :! for more information on this command).
- ralph 14y agoWhat benefit does :!sudo tee % have over doing it at the command line other than filling in the current filename for you? I suspect the original poster meant something like "gg!Gsudo tee %".
- AjithAntony 14y ago:w !sudo tee %
- sousousou 14y agoNeed to send the contents of the file to that command. Otherwise it effectively empties the file. (typo?) :%!sudo tee %