Vi Editor Interview Questions & Answers

  1. Question 1. What Is Vi?

    Answer :

    VI is a Visual Editor (hence the name — vi for VIsual). What is a visual editor (as opposed to a non-visual one)? Visual editors are ones that let you see the document that you are editing as you edit it. This seems pretty common in most editors today, so the idea of a non-visual editor is a little strange. Examples of non-visual editors are sed, ex, ed, and edlin (the last one being the editor shipped with DOS until relatively recently.)

    VI was written by William Joy as part of the bsd distribution of Unix. It was later used by AT&T, and has been standard Unix since.

  2. Question 2. What Is The Big Deal About Vi? Why Does Anyone Use It? More Importantly, Why Should *i* Use It?

    Answer :

    vi is default visual editor under Unix, and is therefore shipped with all recent version of Unix. (Recent being defined as post 1984 or so.) This means that whenever you run across a machine that is running a Unix of some sort, you will know that you have a powerful editor at your finger tips. Why else? vi is a powerful editor. Also, once you know vi, you can edit files really quickly, as it is extremely economical with the keystrokes. Due to its different modes for inserting and issuing commands, it is much faster than most non-mode based editors. It is also a very small editor. (The version on my machine is 200k) Also, it can do almost anything, as long as you know how to get it to do what you want.

  3. Adobe Photoshop Interview Questions

  4. Question 3. What Different Operating Systems Is Vi Available For?

    Answer :

    Unix. That’s it. However, there are many, many clones of vi that are available for different operating systems. I personally have used vi clones under: Unix, Dos, OS/2, Mac System 7.

  5. Question 4. What Are Some Of The Vi Clones That Are Available?

    Answer :

    • Just to list a few: STvi (STevie), elvis, vile, vim, and nvi, xvi.
    • elvis is available for: Amiga, DOS, OS/2, Unix, VMS. 
    • STevie is available for: Atari ST, DOS, Unix. 
    • nvi is the vi that will ship with BSD 4.4. 
    • vim is available for: Amiga, DOS, Mac System 7, Unix. Amiga, DOS, and the source are available at:
    • /misc/editors/vim 
    • vile is available for: DOS, OS/2, Unix, VMS. 
    • xvi is available for: DOS, Unix.

    There are some differences between the different vi clones. Many offer improvements, but most still allow the commands that are listed in this document, but there may be some differences. Refer to the documentation that comes with the clone for details.

  6. Adobe Photoshop Tutorial

  7. Question 5. What Games Will Help Me Learn Vi?

    Answer :

    This may seem a bit silly, but there are many games on Unix systems that can help you learn to use vi. These help particularly with the basics. Although I don’t know of any games that help with every vi command, I do know of a few that will help you learn to use hjkl to move the cursor around. NetHack, a rouge-like game, is particularly good for this, as it is a large game and can be entertaining for quite some time. Not to make the other games sound worse, but some other ones are: rouge, moria, omega, worm, and snake.

  8. Audio Editor Interview Questions

  9. Question 6. What Is The Difference Between Command Mode & Insert Mode?

    Answer :

    Often sited as one of the main problems with vi, and equally often sited as being one of its best strengths, vi differentiates between a “Command mode” and an “Insert mode.” Understanding this difference is VITAL to learning vi. When one starts vi it starts in command mode. In this mode, one can move around the file, and issue commands to change certain areas of the text, cut, copy and paste sections of the text and do much more. Insert mode is where one can actually insert text. In other words, command mode is used to move around the document, and insert mode is used to type text into the document.

    Commands such as: a, i, c, C, O, o and others will switch one from command mode to insert mode.

    or ^C will take one out of insert mode and return one to command mode.

    Get used to this distinction. It is one of the things that makes vi different from most other editors. It also allows one to do a lot of things without taking one’s hands from the standard keyboard position.

  10. Question 7. How Do I Search For Text?

    Answer :

    / will search forward. ? will search backwards. ?? or // will repeat the last search. It is worth noting that these are pretty much standard in Unix. In addition, in vi, n will find the next occurrence. N will repeat the last search, reversing the direction. Regular Expressions may be used within searches.

  11. Sed (Stream Editor) Tutorial
    Proofreader Interview Questions

  12. Question 8. How Do I Search For A Control Sequence?

    Answer :


    ^V will tell vi to take the next character literally, and not to take it as a command.

  13. Question 9. How Do I Reformat Text?

    Answer :

    If your computer has the program fmt on it, all you need to do is type !}fmt from insert mode. This will rejustify the text from the current location until the end of the paragraph. If your machine does not have fmt, you need to find a similar program. (I gather there are many such programs available from the public domain, but I do not know much about them.)

  14. Communication Skills Interview Questions

  15. Question 10. What’s The Deal With All Of These : Commands?

    Answer :

    The commands that follow a : are commands from the ex editor. These allow a lot of flexibility and power. For example, there are many different ways to search and replace, all of with have some similarities.

  16. Content Marketing Tutorial

  17. Question 11. How Do You Do A Search And Replace?

    Answer :

    Well, there are a few methods. The simplest is:

    :s/old/new/g But, this only does it on the current line… So:
    :%s/old/new/g In general,

    Where [range] is any line range, including numbers, $ (end of file), . (current location), % (current file), or just two numbers with a dash between them. (Or even: .,+5 to mean the next five lines). [cgi] is either c, g, i, or nothing. c tells vi to prompt you before the changes, g to change all of the occurrences on a line. i tells vi to be case insensitive on the search. No character after the last slash will only change the first occurrence on the line.

    My favorite method is:

    :g/foobar/s/bar/baz/g This searches for foobar, and changes it to foobaz. It will leave jailbars alone, which the other method will not. This is my favorite method, but is harder to remember. Of course you can also use regular expression search patterns, and a few other commands in the replacement part of the text. If you use ( and ) in the pattern to escape a sequence, you can do lots of nifty things.

    For example:

    :g/(foo)(bar)/s/2/1baz/g will change foobar for foobaz.

    Special sequences allowed are:

    & everything which was matched by the search

    [1-9] The contents of the 1st-9th () pair
    u The next character will be made uppercase
    U The characters until e or E will be made uppercase
    l The next character will be made lowercase
    L The characters until e or E will be made lowercase
    [eE] end the selection for making upper or lowercase

  18. Video Editing Interview Questions

  19. Question 12. How Do I Run A Program From Within Vi?

    Answer :

    :!cmd will run the program cmd. :sh will run an interactive shell. Within this shell, you may, if you want, run vi again. This is particularly useful when you are editing makefiles and config files for programs in an attempt to get a program to compile. The advantage over :e is that you do not need to save the file, and it will be in its old place when you exit the shell.

  20. Adobe Photoshop Interview Questions

  21. Question 13. Any Tips For Making Vi Programmer Friendly?

    Answer :

    :set ai will make it auto-indent for you.

    :set sw=# where # is a number will set the shiftwidth (tabwidth).

    You can then use <<, >> to shift a line left or right. Plus, you can use <% to shift a {, ( or [ set left or right (with >%). You must be on top of the specific {, }, (, ), [ or ] of the pair to shift them.

    :set sm will show the matching {, ( or [ when you type the closing one.

    :set lisp will make some changes that are useful for lisp programming. () will move back and forth over s-expressions, and {} will move without stopping at atoms.

  22. Question 14. How Do I Make A Function Key A Macro?

    Answer :

    If is #n where n is 0-9, it will be mapped to the appropriate function key.

  23. Question 15. What Does The C$ Command Do From Command Mode Using Vi Editor?

    Answer :

    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.

  24. Medical Transcription Interview Questions

  25. Question 16. How To Append A File To Current File Using Vi Editor?

    Answer :

    Alternate approach:

    If you are working in file2 and want to append fie1, than place the cursor where you want to append the new file and use the following command

    :r file1

  26. Question 17. Explain What Is The Format Of Vi Command?

    Answer :

    vi filename

  27. Sed (Stream Editor) Interview Questions

  28. Question 18. Explain What Is The Command Used To Set Margin In Vi Editor?

    Answer :

    Press ESC followed by colon setnu

    eg => :setnu

  29. Audio Editor Interview Questions

  30. Question 19. What Is The Difference Between Zz And :wq Commands In Vi Editor?

    Answer :

    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.

  31. Question 20. What Is The Command Used To Replace Many Characters In Vi Editor?

    Answer :

    For replace many character in vi editor press esc key and then press R for replace many character.

  32. Content Writer Interview Questions

  33. Question 21. How To Enter From Command Mode To Insertion Mode Using Vi Editor?

    Answer :

    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.

  34. Question 22. What Is The Command Used To Append Text After Current Line In Vi Editor?

    Answer :

    The command used to append text after current line in Vi Editor is


  35. Question 23. What Are The Different Modes In Vi Editor?

    Answer :

    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.

  36. Content Marketing Interview Questions

  37. Question 24. What Is The Difference Between Lettered Buffer And Temporary Buffer In Vi Editor?

    Answer :

    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.


    From Command Mode

    “ayy Copy (yank) a line into buffer letter “a”

    “ap Put contents of lettered buffer a below the current line

  38. Proofreader Interview Questions

  39. Question 25. Which Command Is Used To Replace Many Characters In Vi Editor?

    Answer :

    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


  40. Question 26. Explain What Does The /text Command Do?

    Answer :

    /text: it will search for the string. after pressing enter it takes u to that text location.

  41. Defect Reporting Interview Questions