emacs is one of the most popular editors available to UNIX programmers. Emacs does have a menu bar across the top of its interface frame and this can help new users. This tutorial will introduce you to emacs and show you how to create, edit and save files with this powerful and popular UNIX file editor.
This tutorial will not teach you every emacs command that you will ever need to know. Rather, the goal of this tutorial is to introduce you to some of the commands that are available.
This tutorial uses the notation
[Ctrl-x] to indicate that
you should hold the [Ctrl] key down while you press the "x" key. Then,
release both keys. Do not type the "[" and "]" characters,
just type the key combination indicated.
If the character indicated is in upper case like in
you must hold the
[Shift] key down while the character is pressed.
[Ctrl-x-c] to indicates that
you should hold the [Ctrl] key down while you first press and release the "x" key
and keep holding the [Ctrl] key down while you then press and release the "c" key.
Then, release the [Ctrl] key. As before, do not type the "[" and "]" characters,
just type the key combination indicated.
Double quotes are used to indicate that an entire
line of text should be entered as shown.
I assume that you know how to login, logout and open xterm windows in UNIX.
When you create or open a file with Emacs, you are in the edit mode by default, where you can delete characters, words, lines, etc. and perform other types of edits as well. To add information, you just type the text you want to enter. It will be inserted at the point of the cursor.
In this tutorial you will learn the purpose of several [Ctrl] commands. After completing this tutorial, you will have your own quick reference sheet that you can print and add to as you learn more commands.
Creating your own quick reference sheet of Emacs commands will give you practice using Emacs to create and edit text files as well as providing a document for you to refer to if you forget a particular command that you remember learning.
emacs emacs_reference.txtand press Enter. You are now in edit mode and any keys that you type will be inserted into the current buffer (file).
Emacs Quick Reference Sheet ------------------------ Ctrl-x Ctrl-c - to exit Emacs.
Your file should now look like this:
[Ctrl-x][Ctrl-s]to save your work.
[Ctrl-x][Ctrl-c]to exit emacs. You are now back at your shell prompt and your work has been saved in the file
emacs emacs_reference.txtand press Enter to open the file you created in topic #1.
[Ctrl-h]and release, then type a t.
This starts the Emacs Tutorial. Complete this tutorial to learn more about Emacs and what capabilities are available.
The main edit screen is really just one of several "buffers" available to you in Emacs. You will want to become familiar with creating and switching between multiple buffers while you write your programs and other files.
Don't forget to add the Save command (see above) to your reference sheet.
Emacs Quick Reference Sheet ------------------------ Ctrl-x Ctrl-c - to exit Emacs. Ctrl-x Ctrl-s - to save the current buffer. Ctrl-h t - to start Emacs tutorial (don't hold the Ctrl key down while typing the 't')
[Ctrl-x Ctrl-b] to list all currently available buffers.
Follow these steps to modify your emacs_reference.txt file. You should review the the commands explained in topic #2 and try the new ones suggested.
[Meta-x] goto-line [Enter] 4to move to line #4 of the file.
[Ctrl-u]- type to undo a command
Your reference sheet should look like the following perhaps with a few typing errors that you'll correct in the next exercise.
Emacs Quick Reference Sheet --------------------------- Ctrl-x Ctrl-s - save changes Ctrl-x Ctrl-c - exit emacs
In this exercise, you will correct any typing mistakes that you may have made during the previous exercises. Since, it is not possible for me to know exactly which typing errors you may have made, this exercise will be different from the earlier exercises. Instead of a step by step approach, I'll just provide a list of emacs commands that can be used to edit characters in your file. Be sure to try each of them as you edit your "emacs_reference.txt" file.
In this topic you will view the on-line programmer's manual page for emacs. These pages explain each of the options that can be used when starting emacs.
In this lesson you have learned how to create, edit and save text files using emacs, one of the more popular editors available to UNIX programmers.
As you work in emacs and learn new commands, be sure to add them to your quick reference sheet so that you will be able refer to them in the future.
man emacsat a command-line prompt for even more information about the emacs editor and its command line options.
Last modified: 6/16/2003
Feedback, questions or accessibility issues.
Copyright © 2001 Deb Deppeler