Linux

Command Line in Linux

  • Vi / Vim: Save And Quit The Editor Command

To save and quit the vi or vim editor with saving any changes you have made:

If you are currently in insert or append mode, press Esc key.

Press : (colon). The cursor should reappear at the lower left corner of the screen beside a colon prompt.

Enter the following command (type 😡 and press Enter key):

x

OR

x!

OR

wq!

This will quit the editor, and all changes you have made to the document will be saved to the file.

Fig.01: Vi / vim save and quit demo.

 

To quit without saving

:q!
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s