How To Save A File In Vim / Vi With sudo
To save a file, simply type the following command:
:w – Write a file (actually buffer).
!sudo – Call shell with sudo command.
tee – The output of write (vim :w) command redirected using tee.
% – The % is current file name.
:w !sudo tee %
:w – Write a file (actually buffer).
!sudo – Call shell with sudo command.
tee – The output of write (vim :w) command redirected using tee.
% – The % is current file name.
Comments
Post a Comment