Manual (003)
How to use Pico to edit a file
Prepared by: Rahman Tashakkori, Department of Computer Science Appalachian State University

In order to type your C++ or any other programs or text, you will use an editor.  There are several editors that one can use on a UNIX machine.  The most common ones are vi, pico, emacs, and nedit.  Perhaps the most powerful of these four is vi.  One needs some practice to become comfortable with vi.  For now, we will learn pico.  Pico is simpler to learn than vi and it does most of the basic things we may need in an editor.  There is an excellent reference for pico at: http://www.usd.edu/trio/tut/pico/.

Suppose, you want to edit a file that is called template.C.  In order to open that file, you will type:  % pico template.C

This file could be a new file or an existing file.  When the file is a new file, you will get a blank screen and when it is an existing file, the contents of that file will be displayed.  For now, we assume that is a new file.  Upon execution of the above command, you will get the screen on Figure (1).
 
 



The bottom two lines of the screen contain some of the more common commands available. Practice typing a few lines, then save your work by pressing ^X (which means <Ctrl X>). You'll need to confirm the save by pressing 'Y'; typing 'N' will discard changes made to the file.

Figure (2) shows some of the commands available in Pico (alternative keyboard commands are in parentheses). How did I get this screen.  ^G is for hep, then ^v to go to the second page.

Figure (2) - Some of the commands in Pico

Editing in Pico

Figure (3) - Some more commands in Pico