How to do basic file editing with vi

How to do basic file editing with vi


vi is an advanced file editor that was often used in non-graphical OS environments. There is a later file editor built upon vi called vim (vi improved). vim can be installed on Windows with distributions such as gVim. vi comes with features that make non-graphical file editing efficient.




Open vi/vim by running an executable or by typing one of the following:

vi filename.txt

If vi is open and you need to open a specific file, type one of the following:

:o C:\FolderLocationofFile\file.txt
:o /root/FolderLocationofFile/file.txt

Many ‘commands’ start with a ‘:’ such as ‘:o’ to open a file. You can save a file with:

:w C:\FolderLocationofFile\file.txt
:w /root/FolderLocationofFile/file.txt

To go into editing mode, type


To get out of editing mode, press the ‘escape’ key on your keyboard. In editing (insert) mode, you can do

basic file editing, like some other word processing applications. To quit vi/vim, type: