Home » Linux » Save the VI file in the edit, edit and exit proble...

Save the VI file in the edit, edit and exit problems and combat use.



linux, the VI command not only modifies, but also creates and modifies the file.

: VI file name

in this command, the file name, if it exists, directly into the modified interface, if not there, then create and then modify,


vi command save exit:


1. enters the edit command screen, the bottom line of the interface displays, such as "a.txt", "6L", "83C", where a.txt stands for the file name you edited, and is not the input state

at this time

2. keyboard input, and found that the bottom line of the interface becomes a display, such as "- INSERT -", which means entering the real edit mode, you can edit the file;


3. edits the file, press Esc to exit the edit mode. At this point, you'll find that you can't edit it. If you want to continue editing, or press the keyboard to enter, you can.

Note that the

4., when you exit, you can have the following options:: WQ: WQ!: q

: q!

: WQ and: WQ are saved and exited, but one thing is different: WQ is more overbearing than WQ: mandatory exit;

: q! It's different. It means giving up (not) saving exit..

cursor is pushed to the document and then the colon is added. After the cursor is pushed to the last line, you can enter the exit command.

three: simultaneous editing: