Edit: A Tutorial
Ricki Blau
James Joyce
Computing Services
University of California
Berkeley, California 94720
ABSTRACT
This narrative introduction to the use of the text editor edit assumes no prior familiarity with computers or with text editing. Its aim is to lead the beginning UNIX** user through the fundamental steps of writing and revising a file of text. Edit, a version of the text editor ex, was designed to provide an informative environment for new and casual users.
We welcome comments and suggestions about this tutorial
and the UNIX documentation in general.
September 1981
Contents
Introduction 3 Session 1 4 Making contact with UNIX 4 Logging in 4 Asking for edit 4 The ``Command not found'' message 5 A summary 5 Entering text 5 Messages from edit 5 Text input mode 6 Making corrections 6 Writing text to disk 7 Signing off 7 Session 2 8 Adding more text to the file 8 Interrupt 8 Making corrections 8 Listing what's in the buffer (p) 9 Finding things in the buffer 9 The current line 10 Numbering lines (nu) 10 Substitute command (s) 10 Another way to list what's in the buffer (z) 11 Saving the modified text 12 Session 3 13 Bringing text into the buffer (e) 13 Moving text in the buffer (m) 13 Copying lines (copy) 14 Deleting lines (d) 14 A word or two of caution 15 Undo (u) to the rescue 15 More about the dot (.) and buffer end ($) 16 Moving around in the buffer (+ and -) 16 Changing lines (c) 17 Session 4 18 Making commands global (g) 18 More about searching and substituting 19 Special characters 19 Issuing UNIX commands from the editor 20 Filenames and file manipulation 20 The file (f) command 20 Reading additional files (r) 21 Writing parts of the buffer 21 Recovering files 21 Other recovery techniques 21 Further reading and other information 22 Using ex 22 Index 23
Text editing using a terminal connected to a computer allows you to create, modify, and print text easily. A text editor is a program that assists you as you create and modify text. The text editor you will learn here is named edit. Creating text using edit is as easy as typing it on an electric typewriter. Modifying text involves telling the text editor what you want to add, change, or delete. You can review your text by typing a command to print the file contents as they are currently. Another program (which we do not discuss in this document), a text formatter, rearranges your text for you into ``finished form.''
These lessons assume no prior familiarity with computers
or with text editing.
They consist of a series of text editing sessions
which lead you through the fundamental steps
of creating and revising text.
After scanning each lesson and before beginning the next,
you should try the examples at a terminal to get a feeling
for the actual process of text editing.
If you set aside some time for experimentation,
you will soon become familiar with using the
computer to write and modify text.
In addition to the actual use of the text editor,
other features of UNIX will be very important to your work.
You can begin to
learn about these other features by
reading one of the other tutorials
that provide a general introduction to the system.
You will be ready to proceed with this lesson as soon as
you are familiar with (1) your terminal and its special keys,
(2) how to login,
(3) and the ways of correcting typing errors.
Let's first define some terms:
To use the editor you must first make contact with the computer by logging in to UNIX. We'll quickly review the standard UNIX login procedure for the two ways you can make contact: on a terminal that is directly linked to the computer, or over a telephone line where the computer answers your call.
Turn on your terminal and press the RETURN key. You are now ready to login.
If your terminal connects with the computer over a telephone line, turn on the terminal, dial the system access number, and, when you hear a high-pitched tone, place the telephone handset in the acoustic coupler, if you are using one. You are now ready to login.
The message inviting you to login is:
login:
Type your login name, which identifies you to UNIX, on the same line as the login message, and press RETURN. If the terminal you are using has both upper and lower case, be sure you enter your login name in lower case; otherwise UNIX assumes your terminal has only upper case and will not recognize lower case letters you may type. UNIX types ``login:'' and you reply with your login name, for example ``susan'':
login: susan (and press the RETURN key)
UNIX will next respond with a request for a password as an additional precaution to prevent unauthorized people from using your account. The password will not appear when you type it, to prevent others from seeing it. The message is:
Password: (type your password and press RETURN)
Login incorrect. login:
You are ready to tell UNIX that you want to work with edit, the text editor. Now is a convenient time to choose a name for the file of text you are about to create. To begin your editing session, type edit followed by a space and then the filename you have selected; for example, ``text''. After that, press the RETURN key and wait for edit's response:
% edit text (followed by a RETURN) "text" No such file or directory :
"text" No such file or directory
If you misspelled edit by typing, say, ``editor'', this might appear:
% editor editor: Command not found %
Your exchange with UNIX as you logged in and made contact with edit should look something like this:
login: susan Password: ... A Message of General Interest ... % edit text "text" No such file or directory :
You may now begin entering text into the buffer. This is done by appending (or adding) text to whatever is currently in the buffer. Since there is nothing in the buffer at the moment, you are appending text to nothing; in effect, since you are adding text to nothing you are creating text. Most edit commands have two equivalent forms: a word that suggests what the command does, and a shorter abbreviation of that word. Many beginners find the full command names easier to remember at first, but once you are familiar with editing you may prefer to type the shorter abbreviations. The command to input text is ``append''. (It may be abbreviated ``a''.) Type append and press the RETURN key.
% edit text :append
If you make a mistake in entering a command and type something that edit does not recognize, edit will respond with a message intended to help you diagnose your error. For example, if you misspell the command to input text by typing, perhaps, ``add'' instead of ``append'' or ``a'', you will receive this message:
:add add: Not an editor command :
By giving the command ``append'' (or using the abbreviation ``a''), you entered text input mode, also known as append mode. When you enter text input mode, edit stops sending you a prompt. You will not receive any prompts or error messages while in text input mode. You can enter pretty much anything you want on the lines. The lines are transmitted one by one to the buffer and held there during the editing session. You may append as much text as you want, and when you wish to stop entering text lines you should type a period as the only character on the line and press the RETURN key. When you type the period and press RETURN, you signal that you want to stop appending text, and edit responds by allowing you to exit text input mode and reenter command mode. Edit will again prompt you for a command by printing ``:''.
Leaving append mode does not destroy the text in the buffer. You have to leave append mode to do any of the other kinds of editing, such as changing, adding, or printing text. If you type a period as the first character and type any other character on the same line, edit will believe you want to remain in append mode and will not let you out. As this can be very frustrating, be sure to type only the period and the RETURN key.
This is a good place to learn an important lesson about computers and text: a blank space is a character as far as a computer is concerned. If you so much as type a period followed by a blank (that is, type a period and then the space bar on the keyboard), you will remain in append mode with the last line of text being:
.
This is some sample text. And thiss is some more text. Text editing is strange, but nice. .
If you have read a general introduction to UNIX, you will recall that it is possible to erase individual letters that you have typed. This is done by typing the designated erase character as many times as there are characters you want to erase.
The usual erase character varies from place to place and user to user. Often it is the backspace (control-H), so you can correct typing errors in the line you are typing by holding down the CTRL key and typing the ``H'' key. (Sometimes it is the DEL key.) If you type the erase character you will notice that the terminal backspaces in the line you are on. You can backspace over your error, and then type what you want to be the rest of the line.
If you make a bad start in a line and would like to begin again, you can either backspace to the beginning of the line or you can use the at-sign ``@'' to erase everything on the line:
Text edtiing is strange, but@ Text editing is strange, but nice.
You are now ready to edit the text. One common operation is to write the text to disk as a file for safekeeping after the session is over. This is the only way to save information from one session to the next, since the editor's buffer is temporary and will last only until the end of the editing session. Learning how to write a file to disk is second in importance only to entering the text. To write the contents of the buffer to a disk file, use the command ``write'' (or its abbreviation ``w''):
:write
Edit must have a name for the file to be written. If you forgot to indicate the name of the file when you began to edit, edit will print in response to your write command:
No current filename
:write text
We have done enough for this first lesson on using the UNIX text editor, and are ready to quit the session with edit. To do this we type ``quit'' (or ``q'') and press RETURN:
:write "text" [New file] 3 lines, 90 characters :quit %
%logout
This is the end of the first session on UNIX text editing.
Login with UNIX as in the first session:
login: susan (carriage return) Password: (give password and carriage return) ... A Message of General Interest ... %
% edit text "text" 3 lines, 90 characters :
If you want to add more to the end of your text you may do so by using the append command to enter text input mode. When ``append'' is the first command of your editing session, the lines you enter are placed at the end of the buffer. Here we'll use the abbreviation for the append command, ``a'':
:a This is text added in Session 2. It doesn't mean much here, but it does illustrate the editor. .
Should you press the RUB key (sometimes labelled DELETE) while working with edit, it will send this message to you:
Interrupt :
If while typing the line you hit an incorrect key, recall that you may delete the incorrect character or cancel the entire line of input by erasing in the usual way. Refer either to the last few pages of Session 1 if you need to review the procedures for making a correction. The most important idea to remember is that erasing a character or cancelling a line must be done before you press the RETURN key.
Having appended text to what you wrote in Session 1, you might want to see all the lines in the buffer. To print the contents of the buffer, type the command:
:1,$p
This is some sample text. And thiss is some more text. Text editing is strange, but nice. This is text added in Session 2. It doesn't mean much here, but it does illustrate the editor.
it does illustr^Ate the editor.
In looking over the text we see that ``this'' is typed as ``thiss'' in the second line, a deliberate error so we can learn to make corrections. Let's correct the spelling.
In order to change something in the buffer we first need to find it. We can find ``thiss'' in the text we have entered by looking at a listing of the lines. Physically speaking, we search the lines of text looking for ``thiss'' and stop searching when we have found it. The way to tell edit to search for something is to type it inside slash marks:
:/thiss/
And thiss is some more text.
Edit keeps track of the line in the buffer where it is located at all times during an editing session. In general, the line that has been most recently printed, entered, or changed is the current location in the buffer. The editor is prepared to make changes at the current location in the buffer, unless you direct it to another location.
In particular, when you bring a file into the buffer, you will be located at the last line in the file, where the editor left off copying the lines from the file to the buffer. If your first editing command is ``append'', the lines you enter are added to the end of the file, after the current line -- the last line in the file.
You can refer to your current location in the buffer by the symbol period (.) usually known by the name ``dot''. If you type ``.'' and carriage return you will be instructing edit to print the current line:
:. And thiss is some more text.
If you want to know the number of the current line, you can type .= and press RETURN, and edit will respond with the line number:
:.= 2
:2 And thiss is some more text.
The number (nu) command is similar to print, giving both the number and the text of each printed line. To see the number and the text of the current line type
:nu 2 And thiss is some more text.
Now that you have found the misspelled word, you can change it from ``thiss'' to ``this''. As far as edit is concerned, changing things is a matter of substituting one thing for another. As a stood for append, so s stands for substitute. We will use the abbreviation ``s'' to reduce the chance of mistyping the substitute command. This command will instruct edit to make the change:
2s/thiss/this/
2s/ what is to be changed / what to change it to /
Substitute pattern match failed
:2s/thiss/this/ And this is some more text.
:s/thiss/this/
For another illustration of the substitute command, let us choose the line:
Text editing is strange, but nice.
Text editing is nice.
:/strange/s/strange, but //
What we have done here is combine our search with our substitution. Such combinations are perfectly legal, and speed up editing quite a bit once you get used to them. That is, you do not necessarily have to use line numbers to identify a line to edit. Instead, you may identify the line you want to change by asking edit to search for a specified pattern of letters that occurs in that line. The parts of the above command are:
/strange/ tells edit to find the characters ``strange'' in the text s tells edit to make a substitution /strange, but // substitutes nothing at all for the characters ``strange, but ''
You should note the space after ``but'' in ``/strange, but /''. If you do not indicate that the space is to be taken out, your line will read:
Text editing is nice.
Although the print command is useful for looking at specific lines in the buffer, other commands may be more convenient for viewing large sections of text. You can ask to see a screen full of text at a time by using the command z. If you type
:1z
:z
This seems to be a good place to pause in our work, and so we should end the second session. If you (in haste) type ``q'' to quit the session your dialogue with edit will be:
:q No write since last change (:quit! overrides) :
:w "text" 6 lines, 171 characters
:q % logout
This is the end of the second session on UNIX text editing.
Login to UNIX and make contact with edit. You should try to login without looking at the notes, but if you must then by all means do.
Did you remember to give the name of the file you wanted to edit? That is, did you type
% edit text
% edit
:e text "text" 6 lines, 171 characters
Edit allows you to move lines of text from one location in the buffer to another by means of the move (m) command. The first two examples are for illustration only, though after you have read this Session you are welcome to return to them for practice. The command
:2,4m$
:1,3m6
Let's move some text using the command:
:5,$m1 2 lines moved it does illustrate the editor.
This is some sample text. It doesn't mean much here, but it does illustrate the editor. And this is some more text. Text editing is nice. This is text added in Session 2.
:4,$m1
:/And this is some/,/This is text/m/This is some sample/
The copy command is used to make a second copy of specified lines, leaving the original lines where they were. Copy has the same format as the move command, for example:
:2,5copy $
Suppose you want to delete the line
This is text added in Session 2.
:4d It doesn't mean much here, but
If you do not happen to know the line number you can search for the line and then delete it using this sequence of commands:
:/added in Session 2./ This is text added in Session 2. :d It doesn't mean much here, but
This is some sample text. And this is some more text. Text editing is nice. It doesn't mean much here, but it does illustrate the editor. And this is some more text. Text editing is nice. This is text added in Session 2. It doesn't mean much here, but
And this is some more text. Text editing is nice.
:2,3d 2 lines deleted
The previous example assumes that you know the line numbers for the lines to be deleted. If you do not you might combine the search command with the delete command:
:/And this is some/,/Text editing is nice./d
In using the search function to locate lines to be deleted you should be absolutely sure the characters you give as the basis for the search will take edit to the line you want deleted. Edit will search for the first occurrence of the characters starting from where you last edited - that is, from the line you see printed if you type dot (.).
A search based on too few characters may result in the wrong lines being deleted, which edit will do as easily as if you had meant it. For this reason, it is usually safer to specify the search and then delete in two separate steps, at least until you become familiar enough with using the editor that you understand how best to specify searches. For a beginner it is not a bad idea to double-check each command before pressing RETURN to send the command on its way.
The undo (u) command has the ability to reverse the effects of the last command that changed the buffer. To undo the previous command, type ``u'' or ``undo''. Undo can rescue the contents of the buffer from many an unfortunate mistake. However, its powers are not unlimited, so it is still wise to be reasonably careful about the commands you give.
It is possible to undo only commands which have the power to change the buffer -- for example, delete, append, move, copy, substitute, and even undo itself. The commands write (w) and edit (e), which interact with disk files, cannot be undone, nor can commands that do not change the buffer, such as print. Most importantly, the only command that can be reversed by undo is the last ``undo-able'' command you typed. You can use control-H and @ to change commands while you are typing them, and undo to reverse the effect of the commands after you have typed them and pressed RETURN.
To illustrate, let's issue an undo command. Recall that the last buffer-changing command we gave deleted the lines formerly numbered 2 and 3. Typing undo at this moment will reverse the effects of the deletion, causing those two lines to be replaced in the buffer.
:u 2 more lines in file after undo And this is some more text.
The function assumed by the symbol dot depends on its context. It can be used:
Dot can also be combined with the equal sign to get the number of the line currently being edited:
:.=
In this editing session and the last, we used the dollar sign to indicate the end of the buffer in commands such as print, copy, and move. The dollar sign as a command asks edit to print the last line in the buffer. If the dollar sign is combined with the equal sign ($=) edit will print the line number corresponding to the last line in the buffer.
``.'' and ``$'', then, represent line numbers. Whenever appropriate, these symbols can be used in place of line numbers in commands. For example
:.,$d
When you are editing you often want to go back and re-read a previous line. You could specify a context search for a line you want to read if you remember some of its text, but if you simply want to see what was written a few, say 3, lines ago, you can type
-3p
+2p
You may use ``+'' and ``-'' in any command where edit accepts line numbers. Line numbers specified with ``+'' or ``-'' can be combined to print a range of lines. The command
:-1,+2copy$
Try typing only ``-''; you will move back one line just as if you had typed ``-1p''. Typing the command ``+'' works similarly. You might also try typing a few plus or minus signs in a row (such as ``+++'') to see edit's response. Typing RETURN alone on a line is the equivalent of typing ``+1p''; it will move you one line ahead in the buffer and print that line.
If you are at the last line of the buffer and try to move further ahead, perhaps by typing a ``+'' or a carriage return alone on the line, edit will remind you that you are at the end of the buffer:
At end-of-file
or
Not that many lines in buffer
Similarly, if you try to move to a position before the first line, edit will print one of these messages:
Nonzero address required on this command
or
Negative address - first buffer line is 1
The number associated with a buffer line is the line's ``address'', in that it can be used to locate the line.
You can also delete certain lines and insert new text in their place. This can be accomplished easily with the change (c) command. The change command instructs edit to delete specified lines and then switch to text input mode to accept the text that will replace them. Let's say you want to change the first two lines in the buffer:
This is some sample text. And this is some more text.
This text was created with the UNIX text editor.
:1,2c 2 lines changed This text was created with the UNIX text editor. . :
This is the end of the third session on text editing with UNIX.
This lesson covers several topics, starting with commands that apply throughout the buffer, characters with special meanings, and how to issue UNIX commands while in the editor. The next topics deal with files: more on reading and writing, and methods of recovering files lost in a crash. The final section suggests sources of further information.
One disadvantage to the commands we have used for searching or substituting is that if you have a number of instances of a word to change it appears that you have to type the command repeatedly, once for each time the change needs to be made. Edit, however, provides a way to make commands apply to the entire contents of the buffer - the global (g) command.
To print all lines containing a certain sequence of characters (say, ``text'') the command is:
:g/text/p
To issue a global command, start by typing a ``g'' and then a search pattern identifying the lines to be affected. Then, on the same line, type the command to be executed for the identified lines. Global substitutions are frequently useful. For example, to change all instances of the word ``text'' to the word ``material'' the command would be a combination of the global search and the substitute command:
:g/text/s/text/material/g
:5s/text/material/g
Edit does not automatically print the lines modified by a global command. If you want the lines to be printed, type a ``p'' at the end of the global command:
:g/text/s/text/material/gp
:g/ /d 72 less lines in file after global
In using slashes to identify a character string that we want to search for or change, we have always specified the exact characters. There is a less tedious way to repeat the same string of characters. To change ``text'' to ``texts'' we may type either
:/text/s/text/texts/
:/text/s//texts/
Similarly, the last context search may be repeated by typing a pair of slashes with nothing between them:
:/does/ It doesn't mean much here, but :// it does illustrate the editor.
Edit normally searches forward through the buffer, wrapping around from the end of the buffer to the beginning, until the specified character string is found. If you want to search in the reverse direction, use question marks (?) instead of slashes to surround the characters you are searching for.
It is also possible to repeat the last substitution without having to retype the entire command. An ampersand (&) used as a command repeats the most recent substitute command, using the same search and replacement patterns. After altering the current line by typing
:s/text/texts/
:/text/&
://&
Two characters have special meanings when used in specifying searches: ``$'' and ``^''. ``$'' is taken by the editor to mean ``end of the line'' and is used to identify strings that occur at the end of a line.
:g/text.$/s//material./p
The symbol ``^'' indicates the beginning of a line. Thus,
:s/^/1. /
The characters ``$'' and ``^'' have special meanings only in the context of searching. At other times, they are ordinary characters. If you ever need to search for a character that has a special meaning, you must indicate that the character is to lose temporarily its special significance by typing another special character, the backslash (\), before it.
:s/\\$/dollar/
After creating several files with the editor, you may want to delete files no longer useful to you or ask for a list of your files. Removing and listing files are not functions of the editor, and so they require the use of UNIX system commands (also referred to as ``shell'' commands, as ``shell'' is the name of the program that processes UNIX commands). You do not need to quit the editor to execute a UNIX command as long as you indicate that it is to be sent to the shell for execution. To use the UNIX command rm to remove the file named ``junk'' type:
:!rm junk ! :
[No write since last change]
Throughout each editing session, edit keeps track of the name of the file being edited as the current filename. Edit remembers as the current filename the name given when you entered the editor. The current filename changes whenever the edit (e) command is used to specify a new file. Once edit has recorded a current filename, it inserts that name into any command where a filename has been omitted. If a write command does not specify a file, edit, as we have seen, supplies the current filename. If you are editing a file named ``draft3'' having 283 lines in it, you can have the editor write onto a different file by including its name in the write command:
:w chapter3 "chapter3" [new file] 283 lines, 8698 characters
To ask for the current filename, type file (or f). In response, the editor provides current information about the buffer, including the filename, your current position, the number of lines in the buffer, and the percent of the distance through the file your current location is.
:f "text" [Modified] line 3 of 4 --75%--
:w "text" 4 lines, 88 characters :f "text" line 3 of 4 --75%--
The read (r) command allows you to add the contents of a file to the buffer at a specified location, essentially copying new lines between two existing lines. To use it, specify the line after which the new text will be placed, the read (r) command, and then the name of the file. If you have a file named ``example'', the command
:$r example "example" 18 lines, 473 characters
The write (w) command can write all or part of the buffer to a file you specify. We are already familiar with writing the entire contents of the buffer to a disk file. To write only part of the buffer onto a file, indicate the beginning and ending lines before the write command, for example
:45,$w ending
Although it does not happen very often, there are times UNIX stops working because of some malfunction. This situation is known as a crash. Under most circumstances, edit's crash recovery feature is able to save work to within a few lines of changes before a crash (or an accidental phone hang up). If you lose the contents of an editing buffer in a system crash, you will normally receive mail when you login that gives the name of the recovered file. To recover the file, enter the editor and type the command recover (rec), followed by the name of the lost file. For example, to recover the buffer for an edit session involving the file ``chap6'', the command is:
:recover chap6
If something goes wrong when you are using the editor, it may be possible to save your work by using the command preserve (pre), which saves the buffer as if the system had crashed. If you are writing a file and you get the message ``Quota exceeded'', you have tried to use more disk storage than is allotted to your account. Proceed with caution because it is likely that only a part of the editor's buffer is now present in the file you tried to write. In this case you should use the shell escape from the editor (!) to remove some files you don't need and try to write the file again. If this is not possible and you cannot find someone to help you, enter the command
:preserve
File preserved.
If you make an undesirable change to the buffer and type a write command before discovering your mistake, the modified version will replace any previous version of the file. Should you ever lose a good version of a document in this way, do not panic and leave the editor. As long as you stay in the editor, the contents of the buffer remain accessible. Depending on the nature of the problem, it may be possible to restore the buffer to a more complete state with the undo command. After fixing the damaged buffer, you can again write the file to disk.
Edit is an editor designed for beginning and casual users. It is actually a version of a more powerful editor called ex. These lessons are intended to introduce you to the editor and its more commonly-used commands. We have not covered all of the editor's commands, but a selection of commands that should be sufficient to accomplish most of your editing tasks. You can find out more about the editor in the Ex Reference Manual, which is applicable to both ex and edit. One way to become familiar with the manual is to begin by reading the description of commands that you already know.
As you become more experienced with using the editor, you may still find that edit continues to meet your needs. However, should you become interested in using ex, it is easy to switch. To begin an editing session with ex, use the name ex in your command instead of edit.
Edit commands also work in ex, but the editing environment is somewhat different. You should be aware of a few differences between ex and edit. In edit, only the characters ``^'', ``$'', and ``\'' have special meanings in searching the buffer or indicating characters to be changed by a substitute command. Several additional characters have special meanings in ex, as described in the Ex Reference Manual. Another feature of the edit environment prevents users from accidently entering two alternative modes of editing, open and visual, in which the editor behaves quite differently from normal command mode. If you are using ex and you encounter strange behavior, you may have accidently entered open mode by typing ``o''. Type the ESC key and then a ``Q'' to get out of open or visual mode and back into the regular editor command mode. The document An Introduction to Display Editing with Vi provide full details of visual mode.
addressing, see line numbers ampersand, 20 append mode, 6-7 append (a) command, 6, 7, 9 ``At end of file'' (message), 18 backslash (\), 21 buffer, 3 caret (^), 10, 20 change (c) command, 18 command mode, 5-6 ``Command not found'' (message), 6 context search, 10-12, 19-21 control characters (``^'' notation), 10 control-H, 7 copy (co) command, 15 corrections, 7, 16 current filename, 21 current line (.), 11, 17 delete (d) command, 15-16 dial-up, 5 disk, 3 documentation, 3, 23 dollar ($), 10, 11, 17, 20-21 dot (.) 11, 17 edit (text editor), 3, 5, 23 edit (e) command, 5, 9, 14 editing commands: append (a), 6, 7, 9 change (c), 18 copy (co), 15 delete (d), 15-16 edit (text editor), 3, 5, 23 edit (e), 5, 9, 14 file (f), 21-22 global (g), 19 move (m), 14-15 number (nu), 11 preserve (pre), 22-23 print (p), 10 quit (q), 8, 13 read (r), 22 recover (rec), 22, 23 substitute (s), 11-12, 19, 20 undo (u), 16-17, 23 write (w), 8, 13, 21, 22 z, 12-13 ! (shell escape), 21 $=, 17 +, 17 -, 17 //, 12, 20 ??, 20 ., 11, 17 .=, 11, 17 entering text, 3, 6-7 erasing characters (^H), 7 lines (@), 7 error corrections, 7, 16 ex (text editor), 23 Ex Reference Manual, 23 exclamation (!), 21 file, 3 file (f) command, 21-22 file recovery, 22-23 filename, 3, 21 global (g) command, 19 input mode, 6-7 Interrupt (message), 9 line numbers, see also current line dollar sign ($), 10, 11, 17 dot (.), 11, 17 relative (+ and -), 17 list, 10 logging in, 4-6 logging out, 8 ``Login incorrect'' (message), 5 minus (-), 17 move (m) command, 14-15 ``Negative address--first buffer line is 1'' (message), 18 ``No current filename'' (message), 8 ``No such file or directory'' (message), 5, 6 ``No write since last change'' (message), 21 non-printing characters, 10 ``Nonzero address required'' (message), 18 ``Not an editor command'' (message), 6 ``Not that many lines in buffer'' (message), 18 number (nu) command, 11 password, 5 period (.), 11, 17 plus (+), 17 preserve (pre) command, 22-23 print (p) command, 10 program, 3 prompts % (UNIX), 5 : (edit), 5, 6, 7 (append), 7 question (?), 20 quit (q) command, 8, 13 read (r) command, 22 recover (rec) command, 22, 23 recovery, see file recovery references, 3, 23 remove (rm) command, 21, 22 reverse command effects (undo), 16-17, 23 searching, 10-12, 19-21 shell, 21 shell escape (!), 21 slash (/), 11-12, 20 special characters (^, $, \), 10, 11, 17, 20-21 substitute (s) command, 11-12, 19, 20 terminals, 4-5 text input mode, 7 undo (u) command, 16-17, 23 UNIX, 3 write (w) command, 8, 13, 21, 22 z command, 12-13