Editing text files in Linux

“Text editors” are used to edit the text files in Linux. One of the text editor used in Linux is as below.

Vi/Vim text editor.

Vi  is a visual text editor which is available in all the versions of Linux. We can start Vi editor in two ways.

  1. Without using file name with Vi.

Such that : $Vi, see image below


After hitting enter key below screen appears.

  1. Using file name with Vi.

Such that: $Vi Jayesh, see below image.

After hitting enter key below screen appears.

Save commands in Vi editor:
“:w” command is used to “save” the file without exit Vi editor.

“:wq” command is used to “save” file and “exit” the Vi editor.

Shown in below image.


Exit the Vi editor command:
“:q” command is used to exit Vi editor without warning message.

:q!: command is used to exit Vi editor with warning message of exit.

Shown in below image.

EasyExamNotes © 2023