Vi Editor — 8 Basic Commands to get you Ready

Rishab Batra
1 min readMay 15, 2022

The vi editor stands for the visual editor. It is installed in every Unix system. The vi editor has two modes:

  • Command Mode: In command mode, actions are taken on the file. The vi editor starts in command mode. Cut, copy the text and save the file; commands are case sensitive.
  • Insert Mode: In insert mode, entered text will be inserted into the file. The Esc key will take you to the command mode from insert mode.

Creating a new file name

vi new_filename

To enter in insert mode

Just, Press

i

Now you are in insert mode. You can also enter to insert mode in other ways.

Just type the content to the file in insert mode, and if you Wanna go back to command mode press

Esc

Want to discard the changes in your line

Go to command mode and press

u

Note — Below command will work in command mode which you know how to navigate? If you are in insert mode by pressing escape key.

Save the file

:w

Quit the file without saving

:q

Save and Quit the file

:wq

Save and Quit the file with permissions such as nonwritable file

:wq!

Thank You!

— Let me know if facing any doubts or needs to be corrected.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Rishab Batra
Rishab Batra

No responses yet

Write a response