Requirement Creating, Opening Files in VI Modes in VI Editor Saving & Exiting The VI Editor VI Commands, Quick Reference Next Steps
Requirement Creating, Opening Files in VI Modes in VI Editor Saving & Exiting The VI Editor VI Commands, Quick Reference Next Steps
1. Introduction
2. Requirement
3. Creating , opening files in vi
4. Modes in vi editor
5. Saving & exiting the vi editor
6. vi commands , quick reference
7. Next Steps
Introduction:
__________
vi pronounced as " vee eye " is a unix editor available on almost all the unix operating
systems , solaris , bsd ,aix , hpux etc.
This document is a quick reference to vi editor and will be of help if your are new to unix ,
learning unix or just refreshing your vi knowledge after a few years.
Requirements:
____________
In order to work correctly the vi need correct terminal type (TERM) setting .The TERM setting
depends on the type of terminal you have . Commonly used TERM types are vt100 , vt220 and
ansi . In most cases vt100 will work fine . In case vi is not able to understand the TERM you
have given, it starts in open mode giving you a line by line display .
Generally TERM is taken from .profile or /etc/profile but can be set at the command line as :
$TERM=vt100
$export TERM
Modes in vi
____________
vi operates in following two modes :
i. ) Command Mode : After a file is opened it is opened in command mode ,that is , input from
the keyboard will be treated as vi commands and you will not see the words you are typing on
the screen .
ii.) Insert Mode: To enter the text you have to put vi in insert by pressing 'i' or 'a' after which
you can add the text and whatever is being type will be seen on the screen. . To switch between
these mode Esc key is used . Esc i (text mode) Esc (command mode)
1.) Quit without saving : If you don't want to save the work :q will take
you out without saving your editing in vi.
2.) Write & quit : . Simple :w saves the current file but don't exit. For save
and quit :wq is used in vi.
3.) Forced Quite : An ! (Exclamation sign at the end of exit commands
( :q! , :wq! ) causes a forced quit from vi after ignoring editing (for :q!)
or writing (for :wq!) all the changes..
InventioConsulting
Offering Unix , Solaris & IT
Training Services
throughout the UK.
vi editor is all time favorite for the unix admins and there are some books available if you are
interested in exploring the more powers of vi editor. The editor is also covered in system
administration books so you may find a chapter devoted to vi editor in most of the unix system
administration books.
You can purchase unix administration or vi editor books from amazon.com online using the
display panel below.