A lot of time I open a file, make changes and when the time comes to save it realize that I hadn’t sudo’ed it. Learnt that the following command helps:
:w ! sudo tee %
Here’s the reason:
:w tells the vi to save modification of the file
! sudo tee executes the tee command with sudo permissions taking it’s input from :w
% here ...
Continue Reading ?
10
DEC
DEC
0
Share
