Information on using the Emacs text editor

Reviewed by Murray Anderegg 02/27/2013

Emacs is a large and powerful text editor commonly used by programmers.  It is a locally installed package on department Linux machines, and it is maintained by the GNU project with a home page at http://www.gnu.org/software/emacs/.  Following is information on starting emacs, obtaining online help, basic text entry, and using the Meta key.

Starting emacs

To start emacs on a Linux system, type “emacs”.

If you are interested in using emacs, run the tutorial to get basic information.  The tutorial is accessed by typing “Ctrl-h t” (that is, hold down the “control” key and, while holding it down, press “h”.  Then release both keys and press “t”).  The emacs tutorial is quite comprehensive and is recommended as a good way for a new emacs user to become familiar with emacs basics.

Obtaining online help

To get online help, type “Ctrl-h i” (that is, hold down the “control” key and, while holding it down, press “h”.  Then release both keys and press “i”).  There are also man pages (“man emacs”).

Basic text entry

To enter text, just type it in.  Some simple functions:

quit: Ctrl-x Ctrl-c (automtically prompts to save your file).

cursor movement:
up: up arrow or Ctrl-p (“previous”)
down: down arrow or Ctrl-n (“next”)
left: left arrow or Ctrl-b (“back”)
right: right arrow or Ctrl-f (“forward”)

page forward: Ctrl-v
page backward: Esc v

search forward: ctrl-s (simply repeat to use last search target)
global-replace-with-confirm: Esc %

Using the Meta key

If you run emacs in an X environment and you have your DISPLAY environment variable set, emacs will by default bring up its own window.  In the X environment, you can enter all commands starting with Esc by holding down the Meta key type % and hitting the second character of the command.  (The Meta key is different depending on your keyboard and is generally next to the space bar; it may be the Alt, Windows, Macintosh command key.)  For example, to enter the command Esc %, you would hold down the Meta key and then the % key.  You are not required to do this; it is merely another option to using the Esc key.