Summary of essential emacs commands

Use "emacs foo" to create a file named foo, or to edit an existing file named "foo". You can do some work just by typing in the window once emacs comes to life. The backspace or delete key should do what you think it does.

In the list below, C- means "control key", M- means "meta key" (escape). For meta commands, press the meta key, then the other key. Thus M-f stands for the keyboard sequence "press meta key", " press f".

  C-x C-s      Save file
  C-x C-f      Find (open) file.  Emacs asks for file name at bottom of screen.
  C-x C-z      Leave emacs temporarily (return with "fg" ("foreground"))
  C-x C-c      Quit emacs

  C-g          Abort command (get out of trouble)

  C-f          Move cursor forward one character
  C-b          Move cursor backwards one character

  C-n          Move cursor to next line
  C-p          Move cursor to previous line
  C-a          Move cursor to beginning of line
  C-e          Move cursor to end of line

  C-v          Go forward one screen
  M-v          Go backward one screen

  C-k          Kill text from cursor to end of line.  (Cut text out)
  C-y          Yank back killed text. (Paste text in)

  C-l          Redisplay the screen if it is garbled.

  M-f          Move cursor forward one word
  M-b          Move cursor backwards one word
  M->          Move to end of file
  M-<          Move to beginning of file

  C-u 7 C-n    Move forward 7 lines
  C-u 10 C-p   Move back 10 lines

To go to a specific line: Type M-x goto-line <return>, then type the line number followed by <return>. There a shortcuts. Type the command "help -q emacs goto " in a local window to find out about it. (Local shortcut is M-x #).

Emacs has an excellent on-line help tutorial. To use it, start up emacs. When you are "in emacs", type C-h, then type the letter "t". Follow directions. When you wish to leave the tutorial, type C-x C-c.

Many keyboards have "arrow" keys. These move the cursor around in the expected way. The DEC machines have a "compose" key which works like the meta key, except: hold the compose key down while pressing the other key.