Contents
How do I edit a vi file in Linux?
To save a file, you must first be in Command mode. Press Esc to enter Command mode, and then type :wq to write and quit the file.
…
More Linux resources.
| Command | Purpose |
|---|---|
| $ vi <filename> | Open or edit a file. |
| i | Switch to Insert mode. |
| Esc | Switch to Command mode. |
| :w | Save and continue editing. |
How do I open vi editor in Linux?
To open a file in the vi editor to start editing, simply type in ‘vi <filename>’ in the command prompt. To quit vi, type one of the following commands in the command mode and press ‘Enter’. Force exit from vi even though changes haven’t been saved – :q!