next up previous contents index
Next: File Permissions Up: Viewing and Editing Files Previous: Text Viewers   Contents   Index


Editors

There are three text editors that I think you should know about. emacs, pico, and vi are all on the Red Hat Linux distribution and they are also on other versions of UNIX and even other well known operating systems. Editors are sometime hard to learn, but can be very powerful and even necessary for system administrators.

To use emacs you can type emacs followed by the filename. To create or modify a file called text1.txt you would type the following:

bash$ emacs text1.txt

This will take you into the emacs editor. Here are a few commands that you might find very useful:

Ctrl-x Ctrl-s        Save the file
Ctrl-x Ctrl-c        Exit Emacs
Ctrl-k               Cut a line
Ctrl-y               Paste cut lines
Ctrl-h t             Emacs Tutorial

If you want to learn emacs take the tutorial and have fun.

The University of Washington created a mail reader called pine. With it they also created a text editor called pico. Pico is easy for starters to get used to, but does not seem to have very much power as a text editor. To create a file called text2.txt type:

bash$ pico text2.txt

This will take you into the editor. You can there type whatever you want to type, then you can use the commands on the bottom of the screen to do whatever you want. Here are a few commands:

Ctrl-o               Save the file
Ctrl-x               Exit pico
Ctrl-k               Cut a line
Ctrl-u               Paste cut lines
Ctrl-t               Spell Checker

Pico is a pretty easy to use, small editor that does not require as many libraries loaded to run as emacs. This usually does not matter, but if you ever find yourself in linux rescue mode, pico will work while emacs will not.

The vi editor is one of the oldest and most available editors around. emacs is probably more used today, but on those old machines that had the Y2K problem vi is probably available where emacs may or may not. You can create a file with vi by typing:

bash$ vi text3.txt

This will take you into the vi editor, but you must type in commands before you can insert any text. vi has two or three different modes. You start in command mode. From here you can enter text mode or do things like save or edit your document. Here are a few command mode options:

:w                   Save the file
:q                   Exit vi
x                    Delete the current character
i                    Enter Insert Mode
a                    Enter Insert Mode after the current character

When you are in insert mode you can exit by pressing the Escape (ESC) key.


next up previous contents index
Next: File Permissions Up: Viewing and Editing Files Previous: Text Viewers   Contents   Index
Joseph Colton 2002-09-24