Today, let's take a look at the use of the VI editor, the VI editor is primarily used to edit configuration files in a Linux environment.
First, how to use:
1. Enter command vi filename, open file, in a viewing mode
2. Click on Keyboard i to enter insert mode;
3. Modify or enter the content;
4. Press ESC to exit edit mode;
5. Press "Shift" plus "colon", enter Wq, save exit; Q, exit directly; q!, Force exit.
Second, vi editor search
1./string: Search up from the current cursor position
? String: Search down from the current cursor position
2. Find Next: Press "N".
Third, vi Editor add line number (in Ubuntu, for example, other environments may not be the same)
1. Enter the catalogue/etc/vim;
2. Edit the configuration file VIMRC (vi VIMRC);
3. Add a line of content "set Nu" to save the exit.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!! ~~~~~~~~~~~~~~~~~~
Jump to the specified line number and enter directly: N (n = line number to jump)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Iv. vi Editor Replacement text function ~~~~~~~~~~~~~ later
The use of the VI editor for Linux