Emacs is a text editing program. The name stands for Editor macros (a macro is a miniature program which allows a complex function to be built up out of small, simple steps: like making a single keystroke do a lot of work). It is worth spending a little time learning how to use Emacs: because it is so common, so portable, and so powerful. Because of Emacs' wide portability, it has become conventional to use keyboard control characters for many functions, as this avoids you having to move your hand away from the keyboard to use the mouse for common functions, and then back again. In these examples, the notation ^x means "Control-X", which you get by holding fown the "Ctrl" or "Control" key and pressing the named letter key once, then releasing both.
Type emacs at the prompt. To open a file (Emacs uses the term "visit"), type ^x^f followed by the filename. It displays the current directory name as a prefix, but you can backspace over this if you want to load a file from another directory. If the file exists, it is displayed. If it does not, it is created.
Emacs lets you use a trick called "completion" on all filenames or commands you type: if you type the first few characters and then press the TAB key, Emacs will complete it for you if what you have typed is unique. If not, it will let you press TAB again, and display a list of all valid completions for you to pick one of.
To exit from Emacs, press ^x^c. If you have not saved your file(s), Emacs will ask if you want to save them: answer with y for yes or n for no to each one, as prompted.
Emacs automatically makes a backup (safety) copy of your file every 300 keystrokes (this frequency can be changed). To save your file explicitly (a good idea from time to time), type ^x^s.
Arrow keys will work if your terminal is set correctly, otherwise:
With an incremental search, as you type each character of the word, Emacs immediately starts searching, so you may find what you are looking for before completing the word. Press RETURN to stop searching, or ^g to abort the search and return to where you started.
To do a non-incremental search, type ^s or ^r followed by RETURN and then the word or characters you are looking for.
To do global search-and-replace, type ESC x replace-string RETURN then type the text to search for (and press RETURN) then the text to replace it with (and press RETURN). If you are going to do a lot of these, you can assign the command to a keystroke to make it faster to use. There are other more complex pattern-matching searches (using Unix-like "regular expressions") that you can learn later.
If something goes wrong don't worry: