Save and Exit in Vi Editor in Linux
Need to press [Esc] key followed by the colon (:) before typing the following commands:
Commands | Description |
---|---|
q | Quit |
q! | Quit without saving changes i.e. discard changes. |
r [file_name] | Read data from file called [file_name] |
wq | Write and quit (save and exit). |
w | Write to file called [file_name] (save as). |
w! | Overwrite to file called [file_name] (save as forcefully). |
!cmd | Runs shell commands and returns to Command mode. |
vi Editor in Linux
The default editor that comes with the Linux/UNIX operating system is called vi (visual editor). Using vi editor, we can edit an existing file or create a new file from scratch. we can also use this editor to just read a text file. The advanced version of the vi editor is the vim editor.
Table of Content
- How to Open VI Editor
- Modes of Operation in the vi editor
- Linux vi Commands and Examples
- Moving within a File (Navigation) in Vi Editor
- Control Command (Scrolling) in vi Editor
- Inserting and Replacing text in Vi Editor
- Deleting Characters and Lines in Vi Editor
- Copy and Paste in Vi editor in Linux
- Save and Exit in Vi Editor in Linux
- Searching and replacing in (ex-Mode) in Vi Editor (Linux)
- Block delete commands in (x mode) in Vi Editor
- Block copy command in (x mode) in Vi Editor
- Block moving commands in (x mode) in Vi Editor