Table of contents


Emacs Tutorial

Note: the emacs tutorial is much better than this page. To access it, start emacs and type in Ctrl-t (written as C-t).

Opening emacs

To open emacs, type

emacs

at the command prompt. To open emacs with a file, type

emacs filename

at the command prompt. You can open multiple files as follows:

emacs file1 file2 file3

with as many files as you want. See Switching between buffers (files) and Multiple windows to learn how to deal with these.

Closing emacs

To close emacs, type Ctrl-x Ctrl-c. If you have not saved your work, it will ask you to save it.

Saving in emacs

To save a file, type Ctrl-x Ctrl-s. This will automatically save the filename as whatever filename it was before, unless it was in the scratch buffer, in which case it will ask you to enter in a filename.

To save a file with a different name, type Ctrl-x Ctrl-w. This is akin to a “Save As” command.

Opening a file when emacs is already open

Ctrl-x Ctrl-f FILENAME

followed by the enter key will open up that file for you. If no such file is found, it will open up a blank buffer with FILENAME as its name.

Switching between buffers (files)

To switch between files already open in emacs, use Ctrl-x b FILENAME.

Multiple windows

Often, it is useful to open more than one window. To open 2 or 3 windows in one, type in Ctrl-x 2 or Ctrl-x 3. To switch between buffers, type in Ctrl-x o. To get back to one window, type Ctrl-x 1.