Vi Editor Basics for Beginners

In this video I will show you the basic commands necessary to edit files using the VI Editor.  That is the editor that I use in most of my tutorials and there have been questions around how I performed some of the steps pertaining to updating files. Many times I don’t talk about the exact key commands I used and so in this video I will walkthrough very basic usage of vi for beginners or those people that need to follow my tutorials or just need to update some files but are not linux/unix experts. This is not meant to be a full comprehensive tutorial.

  1. Open Files
    1. Use ‘sudo’ for elevated privilege’s to the current users you are logged in with for system and configuration files.
  2. Quit vi without saving (:q!)
  3. Insert new line and add code (o)
  4. Exit out of Insert mode (esc)
  5. Insert mode without a new line added (i)
  6. Delete line (dd)
  7. Delete single character (x)
  8. Move cursor to the beginning of line or end of line ($, ^)
  9. Undo change (u)
  10. Redo change (ctrl+r)
  11. Exit the file without Saving (:q!)
  12. Search text inside a file
    1. type /
    2. enter text to search, enter
    3. type letter ‘n’ to find next line where occurance for the text is found
  13. Paste from clipboard
    1. enter paste mode, (:set paste)
    2. enter Insert mode (i)
    3. Shift+Insert to paste
    4. esc
  14. Paste sometimes also works with right-click