OK - I am linux newbie - I am trying to edit a file from bash via edit <filename>
command in whatever the default mode is (I am assuming 'vi'?).
Problem is for the hell of me I cannot how to save and out of edit mode - this cheatsheet seems to suggest ESC should do the trick but it doesn't seem to work.
I am connecting via ssh from a mac to a linux suse enterprise 11 box.
Any help appreciated!
Esc will only throw you back into command mode in VI or Vim. To Save and quit press Shift + Z + Z, :wq, or :x in command mode. If you are opening the file in read only mode you will have to hit :q!.
Consider looking at this cheatsheet as well for more macros VI cheatsheet
If you are new to Linux I would suggest using something other than
vi
. For instance,nano
is fairly user-friendly, although much less powerful. Also,vim
is a variant ofvi
that has some more features (like syntax highlighting) and is slightly easier to use.In the bash to save the code press esc after esc press the con+x and the alert of do you want to save will appear press "y" over there and hit the enter button.May this help you..
Hitting the I button will enable you to edit the file Hit the Esc button to exit edit mode Then the SHIFT+ZZ or type in :wq to save and exit to command mode