19BCS2848 SWL-1.3

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Experiment: 1.

Aim: Familiarization with the VI editor.

Tools/Software Required: Personal computer, Oracle virtual machine, Ubuntu ISO File.

Description: The objective of this experiment is to know how to create and edit files in VI
editor. In this experiment we will create a file and run various commands on this file using VI
editor.

Pseudo code/Algorithms/Flowchart/Steps:
Starting Vi Editor:- This editor can be invoked by typing vi filename at the prompt. If
you specify a filename as an argument to vi, then the vi will edit the specified file, if it
exists.
Vi<filename>

A status line at the bottom of the screen shows the filename, current line & character
position in the edited file.
Vi<line no><filename>

VI Modes: - The editor works on 3 modes as follows: -

a) Insert Mode: -
(1) The text should be entered in this mode and any key pressed is created as text.
(2) We can enter in this mode through command mode by pressing any of the keysior
I.

b) Command Mode: -
(1) It is the default mode when we start up vi Editor.

NAME: SHUBHAM BHARTI UID: 19BCS2848


(2) All the commands an vi Editor should be used in this mode.
(3) We can enter into this mode from insert mode by pressing. [Esc] key and from Ex
mode by pressing Enter.

c) Ex Mode: -
(1) The ex-mode command can be entered at the last line of the screen of the Mode.
(2) We can enter into this mode directly from input mode or vice-versa.

Implementation:
The following are some commands that are used:
(1). i: Insert before cursor.
(2). X: Delete the character before the cursor.
(3). Yy: Copies the current line.
(4). p: Puts the copied text after the cursor.
(5). o: Creates a new line for text entry below cursor location.
(6). r: Replace single character under the cursor with the next character typed.

Output:

NAME: SHUBHAM BHARTI UID: 19BCS2848


NAME: SHUBHAM BHARTI UID: 19BCS2848

You might also like