Guide to Editors

Your linux operating system will come with one or more editors in which you can write the html code for your web page. This tutorial offers an overview of basic commands from three editors: vi, pico.

Basic Editor Commands

The Vi Editor

The vi editor has two modes; you can edit the file in command mode, and you type in append mode. The editor begins in command mode - type an "i" or a "a" to switch to append mode, and hit the escape key to return to command mode. While in command mode, use the following commands to change your file:

Shift a
moves cursor to the end of the line and switches to append mode
Shift b
moves cursor to the beginning of the line
Shift d
deletes character under cursor and moves cursor one space left
Shift j
joins line below cursor to line with cursor
Shift zz
saves the file and exits the editor
Control d
moves cursor to the bottom of the page
Control j
moves cursor down one line
Control p
moves cursor up one line
Control u
moves cursor to the first character in the file
Control z
suspends editor without saving file
Alt DD
erases the line the cursor is on and moves up one line
Alt h
moves cursor back one space
Alt p
adds a line
Alt u
undoes last command
x
deletes character that the cursor is on

Pico, a slightly more user friendly editor

Pico is simple to use. The command pico filename will open filename, or create filename and allow it to be edited. From there, pico is intuitive. The arrow keys move the cursor. Backspace or delete deletes the character immediately to the left of the cursor. Text is entered at the current cursor location, and behaves something like vi's insert mode; characters to the right of the cursor are shifted to the right as characters are inserted.

Pico displays in the last to lines of the terminal a short list of its commands, where a leading ^ indicates Ctrl-whatever. (Thus, ^G is Ctrl-G, for Get Help, and ^^ is Ctrl-6.)

In fact, Ctrl-^ (or Ctrl-6) is a very useful command. By pressing Ctrl-^, a mark is set at your current location, and all text between the mark and the left edge of the cursor is considered selected. Then certain other commands can be performed on the selection, especially Ctrl-K, to cut the text, which is useful not only for wholesale deletion, but also for cut and paste operations (use Ctrl-U for uncut), or text duplication (Ctrl-U can be used multiple times to paste the text cut to the present location of the cursor.)

One other useful although cryptic command is Read File (Ctrl-R), which loads a copy of a file and writes it into the current file at the current cursor location.

Pico's Get Help command is very useful, and anyone using pico is encouraged to try it. It provides concise but helpful descriptions of all picos commands.

Pico has certain advantages over vi, notably that there is only one mode, and second that pico has an advanced line-wrapping features, such that one doesn't have to hit return at the end of every line. Return to homepage