MA10126
Introduction | Logging in | Directories | Files | Text Editors | Miscellany | File access | Links
5. Text editors
In Windows, there is a
simple editor called Notepad (under Accessories), as well as fancier ones such
as WordPad and Word. Unix also has a range of different editor packages for
creating and modifying text files. Some of these are line editors (where you work
on one line at a time, just like Unix itself), and others are screen editors
(where you see a whole page of text). The Unix help pages from BUCS
describe some of these editors. Here we will introduce you to the
simplest-to-use screen editor, called pico.
You start the editor by
typing
pico filename
Thus, to use pico to create a file called applic (or to open an existing file called applic for editing), type
pico applic
The Unix window now displays
the first screenful of the file (or a blank screen if the file is new), and
helpfully lists the most useful commands at the bottom. You insert text by
simply typing in the screen. The commands are issued by using control keys,
i.e. by holding down the Control key while pressing the relevant letter key
(remember that you use ctrl-c to end execution of a command). The main commands
are:
ctrl-g will display the help
pages (which are unusually clear and concise, for Unix)
ctrl-v will move down to the
next page
ctrl-o will save the current
file, without exiting from the editor
ctrl-x will exit the editor.
You are first prompted whether you want to save the file, and if so what name
you want to give it.
It’s as simple as that.
Press ctrl-g and read through the other commands. Try creating files and saving
them, then using cat to display their contents.
There is a more powerful
editor called emacs which uses drop-down menus like in Windows, instead of
control keys. In emacs, your file is read into a buffer, where you edit it.
When you have finished, you need to choose “save buffer” from the File menu
before exiting. Try typing
emacs applic
and explore the different
menus. BUCS has a guide to emacs at
http://www.bath.ac.uk/bucs/docs/ub-4-3.shtml
and guides to simpler
editors such as ed and vi at
http://www.bath.ac.uk/bucs/docs/ub-4-1.shtml
You can use which ever
editor you wish, so find out which one you like best.
There will be an exercise
involving pico at the end of these notes.
Before getting there, there are a couple of miscellaneous features to tell you
about – click on Miscellany below…
Introduction | Logging in | Directories | Files | Text Editors | Miscellany | File access | Links