Created
May 17, 2012 08:37
-
-
Save settipalli/2717426 to your computer and use it in GitHub Desktop.
Save a file with root permissions from within VIM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This trick will help when you open a file using normal user and then realize that you need to be root to save the file: | |
In command mode: | |
:w !sudo tee % | |
Ref: http://stackoverflow.com/questions/1005/getting-root-permissions-on-a-file-inside-of-vi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment