How do I save files edited with vim?
You're probably in editing/insert mode. You need to type the following sequence :
- Esc, to quit edit mode and fallback to command mode ;
- :+w+q, start with a
:
(colon) then pressw
and finallyq
to write and quit (or just:w
to write without quitting) - then press Enter to valid.
I usually press ESC and then hold Shift and press z twice. Just like you would like to type two capital Z letters in word editor :) That saves your document and closes your editor.
Check whether you have administrative (root) privileges to edit the file. use this command
whoami
If the result is not "root", then you are not supposed to edit the file.
To login as root user, use the below command
sudo su
or
su
Edit the file,
vi /etc/network/interfeces
After the changes, save the file using
- Press
Esc
to change the mode :x
to save and quit the file
Thats all