Sunday, February 16, 2020

vi Editor

The vi editor is visual editor used for creating and editing text files containing data, document or programs. 

It is like Notepad we use in Windows.

It display content of files on the screen and allows user to add, insert, delete or change text. 

Some of the other editors for Linux are

ed (line editor)

emacs(edit macros editor)

red (restricted line editor) etc.


Starting vi editor

SYNTAX: vi filename <Enter>

EXAMPLE: [root@localhost student]# vi msg.txt

-

-

-

-

-

-

-

-

-

-

“msg.txt” [New File]

             To end insertion or append mode, Press <Esc> and type vi editors command.


Commands of vi editor

The vi editor works in two mode insert mode and append mode. After starting vi editor, Press I to add text. The other commands are

:wq<Enter>                         save all changes and quit

:w<Enter>                         save file

:e<filename><Enter>    open specified file

yy or y                     marks current line as line to be copied

                            paste marked text after current cursor position

P                            paste marked text before current cursor position 

Functions of vi editor

1. Vi editor allow user to create a file and write data to it.

2. It allow user to open existing file, modify content and save changes in file.

3. It allows user to copy and paste text from one position in a file to another.’

4. It allow searching for a particular expression or word.

5. Large amount of data can also be handled using vi editor.


1 comment: