How Do I Use Vi Editor in Linux?
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!

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest