Starting the vi Editor
The following table lists out the basic commands to use the vi editor −
=> Following is an example to create a new file testfile if it already does not exist in the current working directory −
Moving within a File
To move around within a file without affecting your text, you must be in the command mode (press Esc twice). The following table lists out a few commands you can use to move around one character at a time
Editing Files
To edit the file, you need to be in the insert mode. There are many ways to enter the insert mode from the command mode −
Deleting Characters
Here is a list of important commands, which can be used to delete characters and lines in an open file
Change Commands
You also have the capability to change characters, words, or lines in vi without deleting them. Here are the relevant commands −
Copy and Paste Commands
You can copy lines or words from one place and then you can paste them at another place using the following commands