My Space

February 5, 2008

Vi Editor

Filed under: My Personel View, My Technical View — Mayank @ 9:55 am

While running through Unix I felt that Vi editor is the very powerful editor in comparison to others and have capability to handle any type of file. It’s same as any other text editor but having some powerful features. Vi editor is written by Bill Joy in 1976 for BSD system. It comes with every Unix system. Vi editor is very and first step to learn Shell Script, generally we write our script in same. To find the Vi editor in Unix, you just go through terminal (In windows, we call it Command Prompt but in Unix we call it Terminal) and type Vi and hit enter. It will open the Vi editor. It is having 3 main modes

  • Command Mode
  • Input Mode
  • Last Line Mode

The default mode of Vi editor which accept any text as a command called as Command Mode. To come in Input mode from command mode you should press “i” key first. It will change Vi command mode to Input mode. Every key pressed after switching to Input mode actually shows up as text. We are writing shell script in Input mode. We used Esc key to take this mode to Command Mode. Last line mode is used to handle files like for saving and perform substitution. Pressing a colon ( :) in the Command Mode invokes this mode.

This is the very basic things about Vi editor but I think it is also useful for beginner. Here you can find some useful command of VI editor http://www.cs.rit.edu/~cslab/vi.html

8 Comments »

  1. Yeah, I agree with you as vi editor is the one of best editors and for shell scripting it’s robust to use.

    Comment by Moses — February 5, 2008 @ 10:36 am

  2. Vi Editor has lots of features. We have to know how to use it powerfully.

    Comment by Raj's blog — February 5, 2008 @ 10:45 am

  3. Really a good one, informative POST !

    -Shruti.

    Comment by Shruti — February 5, 2008 @ 11:11 am

  4. Hey
    Really Vi editor is very powerful. Actually, this editor works on the copy of the file in memory, and only updates the file on disk when you tell it to, such as when you exit.

    Comment by Sri — February 5, 2008 @ 11:58 am

  5. Hi Mayank,

    Yeah, I agree with you as vi editor is the one of best editors and for shell scripting it’s robust to use But Vi has its dark sides, too. The biggest one is the need to step back before leaping forward when you are new to Vi. You cannot use Vi properly before knowing at least a handful of commands. This makes the threshold rather high. Vi doesn’t get fast before you know 25 commands or so, and you won’t be the novice user before you know even more.

    In my opinion if you are a Windows user and you are forced to work under Unix for a week: don’t learn Vi. However, if you need a good, multi-purpose editor, then Vi is a very good, highly recommended choice. Invest some time and learn Vi :) and its good that u r doing so.

    Keep up the good work.

    Regards,
    Ajai

    Comment by Ajai — February 5, 2008 @ 12:56 pm

  6. Vi editor is very simple but one need to be very intelligent to understand its simplicity :)

    Comment by Asit — February 5, 2008 @ 1:17 pm

  7. Hi Mayank,

    I feel this link will also help you to learn UNIX
    http://help.unc.edu/?id=152#startcontent

    Synthia

    Comment by Synthia — February 6, 2008 @ 6:35 am

  8. Thanks Synthia,

    It is really useful site.

    Thanks,
    Mayank

    Comment by Mayank — February 6, 2008 @ 7:17 am

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.