You are on page 1of 1

pico: Rudimentary Text Editing

In Section 1.6.3, we used a workaround to create a file. We used echo with the >
symbol
to create the file foo containing the string date. It s time to learn a program th
at performs
the task of creating and editing a file. Programs that handle editing are approp
riately
called editors, and every UNIX system has a number of them on offer. In this sec
tion
we consider a simple one, viz., the pico command, and in Chapter 5 we present a
very
powerful one (the vi/vim editor).
The pico command is normally invoked with a filename. The file is created if it
doesn t already exist:
pico foo
You ll be presented a full screen (Fig. 3.6), where the topmost line and three lin
es at
the bottom are reserved for messages. The rest of the screen can be used for tex
t input
Chapter 3: The File System 79
with the cursor initially positioned at the beginning of the first line. Observe
the status
line at the top before you enter a few lines of text as shown, with each line fo
llowed by
[Enter]. The moment you have entered a character, the message Modified appears a
t
the top right. This indicates that you have made some change to a buffer (a temp
orary
work area) that has not been saved to disk yet.
The two lines at the bottom show the commonly used key sequences that you ll
need for text editing. All navigation and editing functions in pico are carried
out
using the Control key (shown as ^) along with a letter. For instance, [Ctrl-g] (
shown
as ^G) invokes the help screen, which lists the complete set of internal command
s
offered by this editor. Before we discuss the navigation and editing functions,
let s
save our work. Press [Ctrl-o] when a message pops up at the lower part of the sc
reen
showing the default filename:
File Name to write : foo
You can change the filename if you want, but if you don t want to, simply press th
e
[Enter] key. Your work has been saved. At this point you