# Command of the VI-Editor and implement them.

- Link: https://technotaught.com/command-of-the-vi-editor-and-implement-them/
- Published: 2019-02-28T00:27:38+05:30
- Author: Ashishkumar Vishwakarma

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

#### Theory and Output:

 * The vi editor (short for a visual editor) is text editor which is available on
   almost all [Unix/Linux](https://technotaught.com/study-of-general-commands-of-ubuntu/)
   systems
 * vi has no menus but instead uses combinations of keystrokes in order to accomplish
   commands.
 * you can use vi editors to edit(add, change, and delete text) an existing file
   or to create a new file from scratch. You can also use this editor to just read
   a text file

The [UNIX](https://technotaught.com/basic-networking-command-in-linux-unix/) vi-
editor is a full-screen editor and has two modes of operation:

 * **Command mode**: This mode enables you to perform administrative tasks such 
   as saving files, executing commands, moving the cursor, cutting and pasting lines
   or words, and searching and replacing. In this mode, whatever you type is interpreted
   as a command
 * I**nsert mode**: This mode enables you to insert text into the file. Everything
   that’s typed in this mode is interpreted as input and finally, it is put in the
   file.
 * By default vi is in [c](https://technotaught.com/study-of-general-commands-of-ubuntu/)**
   [ommand mode.](https://technotaught.com/study-of-general-commands-of-ubuntu/)**

## 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.

![Linux vi commands and Implement them](https://technotaught.com/wp-content/uploads/
2019/02/1-1.png)

Also read: – [How To Recover Deleted Files, Photos, Videos, Documents](https://technotaught.com/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)

![Linux vi commands](https://technotaught.com/wp-content/uploads/2019/02/2-1.png)

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

Appending new data.

![Linux vi commands and Implement them](https://technotaught.com/wp-content/uploads/
2019/02/3-1.png)

#### **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.

![a command](https://technotaught.com/wp-content/uploads/2019/02/4-1.png)

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

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

![u command](https://technotaught.com/wp-content/uploads/2019/02/5-1.png)

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

![o command](https://technotaught.com/wp-content/uploads/2019/02/7-1.png)

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

![O command](https://technotaught.com/wp-content/uploads/2019/02/8-1.png)

#### 8**–**d**d command: **This command is used to delete one single line.

One line get deleted.

![dd command](https://technotaught.com/wp-content/uploads/2019/02/9.png)

Suggested: – [How to install Ubuntu on Virtual box for windows.](https://technotaught.com/how-to-install-ubuntu-in-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

![](https://technotaught.com/wp-content/uploads/2019/02/10-1.png)

![d command](https://technotaught.com/wp-content/uploads/2019/02/Capture.png)

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

![Linux vi commands](https://technotaught.com/wp-content/uploads/2019/02/Capture11.
png)

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

![Linux vi commands](https://technotaught.com/wp-content/uploads/2019/02/12-2.png)

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

![Linux vi commands](https://technotaught.com/wp-content/uploads/2019/02/13-1.png)

#### **13- x command**– These commands at cursor.

![Linux vi commands](https://technotaught.com/wp-content/uploads/2019/02/14-1.png)

#### **14-r command: **This command replaces the char.

![Linux vi commands](https://technotaught.com/wp-content/uploads/2019/02/15-1.png)

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

![Linux vi commands](https://technotaught.com/wp-content/uploads/2019/02/16-1.png)

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

![Linux vi commands](https://technotaught.com/wp-content/uploads/2019/02/17-1.png)

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

![](https://technotaught.com/wp-content/uploads/2019/02/18-1.png)

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

![](https://technotaught.com/wp-content/uploads/2019/02/19-1.png)

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

 Before k mode:

 After k command:

![](https://technotaught.com/wp-content/uploads/2019/02/20-2.png)

![](https://technotaught.com/wp-content/uploads/2019/02/22.png)

#### **20-j command: **Move cursor down in command mode

 Before:

After j command:

![](https://technotaught.com/wp-content/uploads/2019/02/22-1.png)

![](https://technotaught.com/wp-content/uploads/2019/02/20-3.png)

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

 Before:

 After h command i.e left:

![](https://technotaught.com/wp-content/uploads/2019/02/21-1.png)

![](https://technotaught.com/wp-content/uploads/2019/02/23-1.png)

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

 Before:

 After h command i.e right:

![Linux vi commands](https://technotaught.com/wp-content/uploads/2019/02/21-1.png)

![Linux vi commands](https://technotaught.com/wp-content/uploads/2019/02/22-2.png)

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

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

**:q command: **This command quit without saving.

![Linux vi commands](https://technotaught.com/wp-content/uploads/2019/02/24-1.png)

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

[Refer 
Basic Networking command

[ Refer General commands in Ubuntu ](https://technotaught.com/study-of-general-commands-of-ubuntu/)

### Share this:

 * [  X ](https://technotaught.com/command-of-the-vi-editor-and-implement-them/?share=twitter)
 * [  Facebook ](https://technotaught.com/command-of-the-vi-editor-and-implement-them/?share=facebook)
 * [More](https://technotaught.com/command-of-the-vi-editor-and-implement-them/#)

 * [  WhatsApp ](https://technotaught.com/command-of-the-vi-editor-and-implement-them/?share=jetpack-whatsapp)
 * [  LinkedIn ](https://technotaught.com/command-of-the-vi-editor-and-implement-them/?share=linkedin)
 * [  Email ](https://technotaught.com/command-of-the-vi-editor-and-implement-them/?subject=%5BShared%20Post%5D%20Command%20of%20the%20VI-Editor%20and%20implement%20them.&body=https%3A%2F%2Ftechnotaught.com%2Fcommand-of-the-vi-editor-and-implement-them%2F&share=email)
 * [  Reddit ](https://technotaught.com/command-of-the-vi-editor-and-implement-them/?share=reddit)
 * [  Tumblr ](https://technotaught.com/command-of-the-vi-editor-and-implement-them/?share=tumblr)
 * [  Pinterest ](https://technotaught.com/command-of-the-vi-editor-and-implement-them/?share=pinterest)
 * [  Telegram ](https://technotaught.com/command-of-the-vi-editor-and-implement-them/?share=telegram)
 * [  Print ](https://technotaught.com/command-of-the-vi-editor-and-implement-them/#print?share=print)

### _Related_

## Comments

### By: Anessa B

- Link: https://technotaught.com/command-of-the-vi-editor-and-implement-them/#comment-137
- Published: 2020-04-24T03:39:32+05:30

Hello there, You have done a fantastic job. I’ll certainly digg it and for my part
recommend to my friends. I’m sure they’ll be benefited from this site.\|
