This section will cover the usage of VI and Pico, two of the most common and oldest UNIX editors. We suggest
that our users get comfortable with VI, not because it's the easiest (it's not), but because it's the oldest
and most widespread, being found on virtually all unix systems on the market, new and old.
Note : All of the Alpha1 servers come with online command manuals. You can learn about a particular command, including VI & Pico,
by typing the following command at the Alpha1 Unix prompt :
man command
... where command is the command you are interesting in getting information and examples on.
I. Using VI
We will discuss the very basics of VI, which will allow you to do simple edits and manipulation of files on
the Alpha1 servers. There are many advanced commands and keystrokes that can be used as found in the online manual pages as described above.
To use VI on a document/file on Alpha1, simply type
vi filename
at the command prompt. If the file does not currently exist, a new one will be created.
There are basically two modes of operation in VI :
- Movement Mode
To navigate around the document use the following keys :
H to move left, L to move right.
J to move down, K to move up.
- Edit Mode
Move the cursor to where you would like to start inputing text/characters, and hit the I key, meaning Insert.
At this point, anything you type will be interested into the document.
To leave Edit mode, hit the ESC key. This will put you back to the default mode, which is Movement Mode.
- Save & Quit Commands
The following are the command sequences to preform basic saves & quits. You must be in Movement Mode to perform these operations.
To double-insure that you are, hit the ESC key. When you type the COLON (:) on the commands below, you will notice that your text and
commands will appear at the bottom of the screen.
| :w |
Writes (saves) the file |
| :wq |
Writes and Quits |
| :w! |
Forces a Write |
| :wq! |
Forces a Write and Quit |
| :q |
Quit (If not saved, no saving done) |
- Bonus Commands & Examples
Here are some extra handy commands :
(MM=Movement Mode, EM=Edit Mode)
| a |
While in MM goes it EM 1 character forward |
| x |
While in MM deletes the character cursor is on |
| O |
Puts you in EM, inserts blank line above |
| o |
Puts you in EM, inserts blank line below |
| dd |
Deletes the line your on |
| yy |
Copies the current line into memory |
| p |
Pastes the line in memory, to the following line. |
II. Using Pico
PICO is a much easier online editor to navigate with, but isn't as wide-spread on Unix systems as VI is.
The PICO version that Alpha1 offers is a full screen navagational program, just like your standard windows edtior, including a speller.
- Use the arrow keys to navigate around the screen
- To use items on the menu below, the ^ sign means use the Control key in conjunction with the alphabet letter.
NOTE : VI is a better editor for scripts because, unlike pico, it can see the imbedded end-of-line markers (^M) that windows editors leave behind at the end of each line, that invariably
cause various scrips and programs to interpret them as actions, causing havoc.
|