VI Editor (Visual Editor): -
Q) Why we go for Vi Editor ?
Ans – We cannot edit files in cat
command. So for editing files, we go for Vi editor.
Q) How many modes are there in Vi
Editor and what are they ?
Ans – There are three modes in Vi
Editor. Such as –
1. Command
Mode
2. Insert
Mode
3. Colon
Mode
Q) Which mode is there in vi editor
when you are trying to open a file using vi editor ?
Ans – command mode
Q) How you go for insert mode from
command mode in vi editor ?
Ans – By pressing key ‘i’ in
command mode.
Q) How you come back to command
mode from insert mode ?
Ans – By pressing ESC key in insert
mode.
Q) How you open a file f1 in vi
editor ?
Ans - $ vi filename<Enter –
Key>
Q) How you enter text in current
cursor position ?
Ans – By pressing key ‘i’ in
command mode
Q) How you insert text in beginning
of current line ?
Ans – By Pressing Key ‘Capital I’
in command mode
Q) How you insert text after
current cursor position ?
Ans – By pressing key ‘a’ in command
mode
Q) How you insert text after end of
current cursor line ?
Ans – By pressing key ‘Capital A’
in command mode
Q) How you create a new line below
current cursor line ?
Ans – By pressing key ‘o’ in
command mode
Q) How you create a new line above
current cursor line ?
Ans – By pressing key ‘Capital O’
in command mode
Q) How you move cursor to left by
one place ?
Ans – By pressing key ‘h’ in
command mode
Q) How you move cursor to down by
one line ?
Ans – By pressing key ‘j’ in command
mode
Q) How you move cursor to right by
one place ?
Ans – By pressing key ‘k’ in
command mode
Q) How you move cursor to up by one
line ?
Ans – By pressing key ‘l’ in
command mode
Q) How to bring cursor in 1st
line ?
Ans – By pressing 1G in command mode
Q) How to bring cursor in nth line
?
Ans – By pressing nG in command
mode
Q) How to bring cursor in last line
?
Ans – By pressing G in command line
Q) Which is used in command mode to
replace character under cursor ?
Ans – By pressing r or s in command
mode
Q) How you delete a single
character under cursor ?
Ans – By pressing x in command mode
Q) How to delete characters till
the beginning of next word ?
Ans – By pressing dw in command
mode
Q) How to delete current line ?
Ans – By pressing dd in command
line
Q) How you copy one line and paste
in desired place in vi editor ?
Ans – By pressing yy in command
line. It copy the current line and place the cursor the position where you want
to paste and then hit ‘p’.
Q) How you search pattern in
forward and backward direction ?
Ans – In command mode, /pattern
will search pattern in forward direction.
In command mode, ?pattern will
search pattern in backward direction
Q) How you save the content and
then exit from vi editor ?
Ans – In command mode :wq will
bring you from vi editor and also save the content
Q) How you quit from vi editor
without saving ?
Ans – By pressing :q in command
mode
Q) How you save the vi editor file
content without exiting ?
Ans – By pressing :w in command
mode
Q) Suppose you modified the content
of a file through vi editor. But you want to exit from vi editor without any
modification of file.
Ans – By pressing :q! in command
mode.
Q) How you display line numbers in
vi editor ?
Ans – By pressing :set nu in
command mode
Q) How you replace bad to good in
10th to 34th lines of a file f1 through vi editor ?
Ans – By pressing
:%10,34s/bad/good/g in command mode
Q) How you replace a word he to she
present in 3rd field through vi editor ?
Ans – By pressing :%s/he/she/3
through vi editor
No comments:
Post a Comment