WSU logo


College of Engineering & CS
Wright State University
Dayton, Ohio 45435-0001

CEG 333: Introduction to Unix

Prabhaker Mateti

Introduction to Emacs


Emacs is a very powerful Unix text editor (it is also available for other platforms, including Windows). It has been around for three decades, and will be around for many more, so if you learn it now you will have a powerful tool to use wherever your career takes you. It includes features to make almost any kind of work easier: if properly configured it can be a full-featured IDE like Visual Studio, a mail client like Outlook, or both.

(Some Unix users prefer the "vi" editor. However, this class is Emacs based.)

To start Emacs, simply type "emacs", optionally appending the filename(s) you wish to edit.

Note: When using a graphical environment you may with to make use of the "&" character. Adding this to the end of a command ("emacs &") causes it to run in the background, so Emacs can be used in its window and the shell can accept new commands in its xterm.

Most Emacs commands use more than one key: they have a prefix key which must be typed first. There are two standard ways of writing these keys. One uses a caret ("^") to represent the "control" key. The other, used extensively in Emacs, represents control with "C-".

While holding down "control", press and release "x", then (still holding down "control") press and release "c".

in shorthand one could write either "^X^C" or "C-x C-c".

Useful Emacs key commands (also called keybindings):

Key Meaning
C-x C-c Exit Emacs, asking if files should be saved
C-x C-f Open a file
C-x C-s Save the current file
C-g Cancel the command in progress