The most
common mistake we do while having sudo access to a Linux system is,
We open
a file normally using vi/vim
E.g. vim file.txt
And edit
the file and while saving you get an error saying file opened in read only
mode. So you will go back and open the file with sudo permission
E.g. sudo vim file.txt
Then
edit the file again and save it.
No more
need for this:-D
While saving
the file using “ :w , :wq , or :x “
Use the
following command to write the file even if you opened the file as a normal user
(without providing sudo).
:w !sudo
tee % , or
:wq !sudo
tee % , or
:x !sudo
tee %
Now you have saved the file.
Follow the video tutorial for reference(Credits to Sudesh Kumar).
No comments:
Post a Comment