How to Use VI Editor in Linux

This tutorial is about How to Use VI Editor in Linux. We will try our best so that you understand this guide. I hope you like this blog, How to Use VI Editor in Linux. If your answer is yes, please do share after reading this.

So lets keep reading for intertesting info:

Check How to Use VI Editor in Linux

Advanced versions of the vi editor are available today, and the most popular is VIM, which stands for Vi Enhanced. Some of the others are Elvis, Nvi, Nano and Vile. Learning vi is recommended as it offers many features and endless possibilities for editing files. To work with the VI editor, you must understand its capabilities. They can be divided into two main areas. Vi or Visual Editor is the default text editor that comes with most Linux systems. It is a terminal-based text editor that users should learn to use, especially if easier-to-use text editors are not available on the system.

In command mode, users run commands to perform actions on a file. The VI Editor is usually started in command mode. Here, the words you type act as commands. Therefore, you must be in command mode when you issue a command. Insert mode, on the other hand, is where you edit the file. Here, the text is inserted into the file. Therefore, you must be in insert mode to enter text. Just type “i” to enter insert mode. Use the Esc key to switch from insert mode to command mode of the editor. If you don’t know what mode you are in, press the Esc key twice. This will take you into command mode.

VI editor insert mode:

  • This mode is for inserting text into the file.
  • You can switch to insert mode from command mode by pressing ‘i’ on the keyboard
  • Once you are in Insert mode, any key will be taken as input for the file you are currently working on.
  • To return to command mode and save the changes you have made, you need to press the Esc key

How to use vi editor

To start the VI Editor -Open the Terminal (CLI) and type

  • saw either

And if you specify an existing file, the editor will open it for you to edit. Otherwise you can create a new file.

VI Edit Commands

  • i – Insert at cursor (goes to insert mode)
  • a – Write after cursor (enters insert mode)
  • A: write to the end of the line (goes into insert mode)
  • ESC – End insert mode
  • u – Undo last change
  • U – Undo all changes on the entire line
  • o – Open a new line (go into insert mode)
  • dd – Delete line
  • 3dd – Delete 3 lines.
  • D – Delete the content of the line after the cursor
  • C: removes the content of a line after the cursor and inserts new text. Press the ESC key to finish inserting.
  • dw – Delete word
  • 4dw – Delete 4 words
  • cw – Change word
  • x – Delete character at cursor
  • r – Replace character
  • R: overwrite characters from cursor forward
  • s – Substitute a character under the cursor continue inserting
  • S – Replace the entire line and start inserting at the beginning of the line
  • ~ – Change case of individual character

Move within a file

  • k – Move cursor up
  • j – Move cursor down
  • h – Move cursor left
  • l – Move cursor right

Final words: How to Use VI Editor in Linux

I hope you understand this article, How to Use VI Editor in Linux. If your answer is no, you can ask anything via the contact forum section related to this article. And if your answer is yes, please share this article with your friends and family to give us your support.

Editorial Staff
Editorial Staffhttps://www.bollyinside.com
The Bollyinside editorial staff is made up of tech experts with more than 10 years of experience Led by Sumit Chauhan. We started in 2014 and now Bollyinside is a leading tech resource, offering everything from product reviews and tech guides to marketing tips. Think of us as your go-to tech encyclopedia!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Related Articles

Best Telemedicine Software: for your healthcare practice

Telemedicine software has transformed my healthcare visits. It's fantastic for patients and doctors since they can obtain aid quickly. I...
Read more
I love microlearning Platforms in today's fast-paced world. Short, focused teachings that engage me are key. Microlearning platforms are great...
Think of a notebook on your computer or tablet that can be changed to fit whatever you want to write...
As of late, Homeschool Apps has gained a lot of popularity, which means that an increasing number of...
From what I've seen, HelpDesk software is essential for modern businesses to run easily. It's especially useful for improving customer...
For all of our important pictures, stories, and drawings, Google Drive is like a big toy box. But sometimes the...