How To Exit (quit) Linux Vi Editor With Or Without Saving Changes Step ...
Có thể bạn quan tâm
How to exit (quit) Linux vi editor with or without saving changes Step-by-Step Nov 28, 2016
—
by
Dan Stolts ITProGuru in UncategorizedIncredibly simple; if you know how….
First how to launch vim
From the command prompt:
change to path where file is located with “cd”
vi filename
This will edit filename starting at line 1.
=========================
To exit without saving changes made:
- Press <Escape>. (You must be in insert or append mode if not, just start typing on a blank line to enter that mode)
- Press : <colon>. The cursor should reappear at the lower left corner of the screen beside a colon prompt. The colon indicates that what follows is a Vim command.
- Enter the following: q!
- Then press <Enter>. This will quit the editor, and abandon all changes you have made; all changes to the document will be lost.
To exit with saving changes made:
- Press <Escape>. (You must be in insert or append mode if not, just start typing on a blank line to enter that mode)
- Press : <colon>. The cursor should reappear at the lower left corner of the screen beside a colon prompt. The colon indicates that what follows is a Vim command
- Enter the following: wq Type “wq” , the “w” indicates that the file should be written, or saved which will overwrite existing file and the “q” indicates that vim should quit, or exit
- Then press <Enter>. This will quit the editor, and write all changes you have made; all changes to the document will be saved.
After exiting you can display the contents of the file with
cat filename
GURU-TipLinuxStep-By-Step Previous: Step-By-Step Hands on Lab Managing Docker on Windows with Hyper-V Virtual Lab now available Next: Lab Guide Working with Containers on Windows 10–Includes Docker and Nano Step-By-StepTừ khóa » Vi Commands Exit
-
More Linux Resources
-
How To Exit (Quit) Linux Vim/Vi Editor - PhoenixNAP
-
How To Exit The Vi Or Vim Editor - How-To Geek
-
Quit The Vi Editor Without Saving Your Changes
-
How To: Vi / Vim Save And Quit The Editor Command - NixCraft
-
How To Exit Vim – Vim Save And Quit Command Tutorial
-
How Do I Exit Vim? - Stack Overflow
-
Saving Changes And Quitting Vi
-
How To Exit From Vi In Linux Code Example
-
How To Exit A File In Vi / Vim Editor In Linux - Tecmint
-
Basic Vi Commands - Colorado State University
-
How To Exit Vim? Multiple Ways To Quit Vim Editor - It's FOSS
-
How To Save A File In Vim / Vi And Quit The Editor - Linuxize
-
10 Ways To Quit/Exit From Vim Editor In Linux/UNIX? Examples - Java67