Site icon Technotaught

Command of the VI-Editor and implement them.

In this article, we explain to you Linux vi commands and Implement them.

Theory and Output:

The UNIX vi-editor is a full-screen editor and has two modes of operation:

Linux vi commands and Implement them

Refer one by one command to better understand

The Syntax for creating (if not created before) and opening files in vi-editor:

$ vi <file-name>

1– i command:- This command is used to insert data in the file/used to go in insert mode.

After pressing (i) it will go into insert mode and we can write some content inside the file.

Also read: – How To Recover Deleted Files, Photos, Videos, Documents

2- Esc command: This command is used to escape out from the insert mode and come back to the command mode.

Note(you can see the difference between above 2 pics with cursor position)

3-a command:- This command is used to append the more data/go back to the insert mode.

Appending new data.

4-A command:- This command is also used for inserting a new data but at the end of line/goes into insert mode

This image shows cursor is in the midway.

5-u command: This command is used for  undo the last change.(we have added rollno here)

That last change undo. Note :(U command undo all the changes to the entire line)

6-o command: This command a new line/goes into insert mode.

7- O command:- This command before a new line/goes into insert mode.

8dd command: This command is used to delete one single line.

One line get deleted.

Suggested: – How to install Ubuntu on Virtual box for windows.

9-D command: This command delete the content of the line after cursor

You can see delete command work after m i.e. M Matunga.

. You can delete one by one word also


10- C command:- This command the content of the line after cursor and insert new text.

11- dw command:– This command deletes a single word.

12- cw command:– This command changes the word.

13- x command– These commands at cursor.

14-r command: This command replaces the char.

15-R command: This command overwrites char from cursor onwards.

16-s command: This command substitute one char under cursor and continue to inserting from that position.

17-S command: This command substitute entire line and begin to insert at the beginning of the line.

18-~ command: This command change char of each case.

19-k command: Move cursor up in command mode.

Before k mode:

After k command:

20-j command: Move cursor down in command mode

Before:

After j command:

21-h command: This command move cursor left in command mode

Before:

After h command i.e left:

22-l command: This command move cursor in right direction.

Before:

After h command i.e right:

23- w command : This command saves the file but keep it open

24-shift+zz : wq command: These both commands save the file and quit

:q command: This command quit without saving.

Conclusion : Hence we have done the study of vi-editor with its basic commands.

Exit mobile version