Vi Editor Interview Questions And Answers
Download Vi Editor Interview Questions and Answers PDF
Sharpen your Vi Editor interview expertise with our handpicked 14 questions. Each question is crafted to challenge your understanding and proficiency in Vi Editor. Suitable for all skill levels, these questions are essential for effective preparation. Get the free PDF download to access all 14 questions and excel in your Vi Editor interview. This comprehensive guide is essential for effective study and confidence building.
14 Vi Editor Questions and Answers:
Vi Editor Job Interview Questions Table of Contents:
1 :: Explain What does the /text command do?
/text: it will search for the string. after pressing enter
it takes u to that text location.
Read Moreit takes u to that text location.
2 :: Which command is used to replace many characters in Vi Editor?
change command can be used to change a word/line.
cw change word forward
cb change word backward
c$ change from cursor to end of line
cL change from current line to and of screen
cG change from current line to and of file
or if you want to replace all occurence of some specific
character
:%s/oldText/newText/g
Read Morecw change word forward
cb change word backward
c$ change from cursor to end of line
cL change from current line to and of screen
cG change from current line to and of file
or if you want to replace all occurence of some specific
character
:%s/oldText/newText/g
3 :: What is the difference between lettered buffer and temporary buffer in Vi Editor?
Temporary Buffer
Deleted or copied text goes into a temporary unnamed
buffer. The contents of the temporary buffer may be
retrieved by using the p or P commands.
Lettered Buffers
There are 26 lettered buffers (a-z). Contents of a lettered
buffer are saved until you copy or delete more characters
into it, or until you quit your current vi session.
eg.
From Command Mode
"ayy Copy (yank) a line into buffer letter "a"
"ap Put contents of lettered buffer a below the
current line
Read MoreDeleted or copied text goes into a temporary unnamed
buffer. The contents of the temporary buffer may be
retrieved by using the p or P commands.
Lettered Buffers
There are 26 lettered buffers (a-z). Contents of a lettered
buffer are saved until you copy or delete more characters
into it, or until you quit your current vi session.
eg.
From Command Mode
"ayy Copy (yank) a line into buffer letter "a"
"ap Put contents of lettered buffer a below the
current line
4 :: what are the different modes in vi editor?
There are three basic modes of vi:
Command mode
This is the default when you enter vi. In command mode,
most letters, or short sequences of letters, that you type
will be interpreted as commands, without explicitly
pressing Enter . If you press Esc when you're in command
mode, your terminal will beep at you. This is a very good
way to tell when you're in command mode.
Insert mode
In insert mode, whatever you type is inserted in the file
at the cursor position. Type a (lowercase letter a, for
append) to enter insert mode from command mode; press Esc
to end insert mode, and return to command mode.
Line mode
Use line mode to enter line oriented commands. To enter
line mode from command mode, type a colon ( : ). Your
cursor moves to the bottom of the screen, by a colon
prompt. Type a line mode command, then press Enter. Any
sensible command from the Unix line editor ex will work,
and a few are good to know about. These commands are
indicated in this handout by a colon in front of the
command. Each time you use a line mode command, you must
type a colon to enter line mode, then type the command by
the colon prompt at the bottom of the screen, then press
Enter when you finish typing the command. (The search
commands starting with / and ? work similarly.
Read MoreCommand mode
This is the default when you enter vi. In command mode,
most letters, or short sequences of letters, that you type
will be interpreted as commands, without explicitly
pressing Enter . If you press Esc when you're in command
mode, your terminal will beep at you. This is a very good
way to tell when you're in command mode.
Insert mode
In insert mode, whatever you type is inserted in the file
at the cursor position. Type a (lowercase letter a, for
append) to enter insert mode from command mode; press Esc
to end insert mode, and return to command mode.
Line mode
Use line mode to enter line oriented commands. To enter
line mode from command mode, type a colon ( : ). Your
cursor moves to the bottom of the screen, by a colon
prompt. Type a line mode command, then press Enter. Any
sensible command from the Unix line editor ex will work,
and a few are good to know about. These commands are
indicated in this handout by a colon in front of the
command. Each time you use a line mode command, you must
type a colon to enter line mode, then type the command by
the colon prompt at the bottom of the screen, then press
Enter when you finish typing the command. (The search
commands starting with / and ? work similarly.
6 :: How to enter from command mode to insertion mode using Vi Editor?
There are several commands that put the VI editor into
insert mode. The most commonly used commands to get into
insert mode are a and i.
Read Moreinsert mode. The most commonly used commands to get into
insert mode are a and i.
7 :: What is the command used to replace many characters in Vi Editor?
for replace many character in vi editor press esc key and
then press R for replace many character.
Read Morethen press R for replace many character.
8 :: What is the difference between ZZ and :wq commands in Vi Editor?
ZZ is the command mode comand in uix to save and quit file.
:wq is the execute command mode command to save and quit
file.
Read More:wq is the execute command mode command to save and quit
file.
9 :: Explain What is the command used to set margin in vi editor?
Press ESC followed by colon setnu
eg => :setnu
Read Moreeg => :setnu
11 :: How to append a file to current file using Vi Editor?
Alternate approach:
If you are working in file2 and want to append file1, than
place the cursor where you want to append the new file and
use the following command
:r file1
Read MoreIf you are working in file2 and want to append file1, than
place the cursor where you want to append the new file and
use the following command
:r file1
12 :: What does the c$ command do from command mode using Vi Editor?
c$ will begin from the character under the curser till the
end of line. so when you use this command it will show you $
sign at the end of the line and you can change till that point.
Read Moreend of line. so when you use this command it will show you $
sign at the end of the line and you can change till that point.
14 :: What are the navigators in vi editor?
j- moves the cursor down
k- moves the cursor up
h- moves the cursor left
l- moves the cursor right
Read Morek- moves the cursor up
h- moves the cursor left
l- moves the cursor right