Thursday, October 1, 2009

'vi' Editor for noobs, A beginner's guide.

Posted by BUSTLER |
Tagged With


'VI' is abbreviation for the visual. visual is command for another editor(line editor) in UNIX that is Extended(EX).
vi Editor is the spinal cord of Linux terminal, it has been inside it thriving for years.
Now it comes with name of VIM where IM stands for improved.
It is cross platform and is found on every Linux distro.
If you have freshly installed Linux and now want your feet wet in it, its time to master terminal because this is something which will give you ease with any Linux platform.
VI editor is not just another text editor, it has its own importance in the hearts of shell scriptors. If used with full capabilities it is none less than IDE(Integrated development environment) or in fact is an IDE.
It is licensed under GNU and open source is backing is responsible for its continuing growth. vi editor is text editor but graphical avatar gVim is also available.


Here are some tips for using VI or VIM editor:

  • For opening vi editor first open terminal and write:
vi filename
Now hit i for insert.
  • For exiting writing mode hit escape.
  • Write man vi any time for help pages for vi.
Shift+G will take you to the last line.
  • If finished with your work you can save your work by hitting :w or Esc+Z+Z.
  • If don't want to save the work and simply quit then :q.
  • :wq for t\quick save and exit.
  • yy is used for copying and p for pasting.
  • :n moves to nth line.
  • :s/search_string/replacement_string/
This is the pattern for searching and replacing the string s is for searching.
Line number can also be specified after colon for the replacement.
%s will do the same purpose.
  • :g will search whatever specified and commit specified action
Pattern is:
:g/search pattern/command


  • Contrary to above
:v/string/d
This will delete every line which does no contain specified string, d deletes the string.
:g/^$/d
It deletes every empty line.

Ain't it enough for a beginner.

For Vi, Vim or gVim click :
DOWNLOAD