Linux edit save file command

1, vi and vim two working modes

command mode: the default mode after opening a file is

edit mode: open the file keyboard input “I” into the insert edit mode, a mode of operation to add, delete and change.

2, the keyboard input “I” into the edit mode, you can write the file

how do I save the file after I write it?

1) press “esc” to exit edit mode, switch to command mode, and then enter the following command to

these operations must be done in command mode.

2) save and exit file: “:wq”

3) if you only want to save the file: “:w”

4) discard all file modifications: “:q!”

Read More: