Very Basic Emacs Tutorial

Emacs is a great text-editor (no unexpected line wrapping as with pico, and much more userfriendly then vi). You can do a lot of things with Emacs, which can make it confusing at first. Here are just a few commands to get you started quick!

Emacs doesn't want to start, complaining about terminal type or something...
You are probably using some terminal type the server doesn't know. Set the terminal type to 'good old' vt100 by typing: setenv TERM vt100
You can check which terminal type you are using by typing: echo $TERM
Another reason might be that you are trying to start the X11 version of emacs and you don't have X11 packets forwarded. Try starting emacs by typing: emacs -nw

Delete/Backspace key not working?
Put the following lines in your ~/.emacs file (a settings file for emacs, named .emacs located in your home directory):

     (keyboard-translate ?\C-h ?\C-?)  ; translate `C-h' to DEL
     (keyboard-translate ?\C-? ?\C-h)  ; translate DEL to `C-h'.
     (global-set-key [?\C-h] 'delete-backward-char) 
     (global-set-key [?\C-x ?h] 'help-command)

Conventions used:
C- means press and hold the Control key. Example: C-x type an x while holding the Control key.
M- means the Meta key, which is normally Escape. Example: M-x Unlike with C-x you don't have to hold the Esc key while typing x. Just hit the Esc key, followed by an x

Create a new or open an existing file (say filename.txt) with emacs from the command-line:
emacs filename.txt

Saving a file without exiting:
C-x s (type an x while holding the Control key. Release the Control key and type an s.) -or- C-x C-s (this is one of the few commands where you don't really have to release the Control key..., so typing an x while holding the Control key, then type an s without releasing the Control key works as well)

Saving a file with a different filename:
C-x C-w (hold the Control key while typing an x followed by a w)

Getting out of emacs (will prompt if you want to save the file):
C-x C-c

Page down: C-v
Page up: M-v
Go to the end of the file: M-> (hit Esc, then while holding Shift hit >)
Go to the beginning of the file: M-<

Go to beginning of line: C-a
Go to the end of line: C-e

Cancel some messed up command sequence: C-g
Undo: C-x u
Oops, my window split. Revert to one: C-x 1

Search: C-s
Search and Replace: M-%

Delete (kill) line/paragraph from cursor onwards: C-k
Paste the previously killed part (yank): C-y
Killing a large amount of text (region): Set a mark at start of the region (C-space), move cursor to the end of the region you want to delete and type C-w.

Jumping back and forth: C-x C-x. Set a mark with C-space

Wrap (break) long lines of text: M-q or align on both sides M-1 M-q

Emacs creates backup files automatically. The have an ~ appended to the filename. Always good to have when you saved something and want to go back to an earlier version.

xemacs is the X-windows version, where you can actually use your mouse to use the menu and/or click somewhere.

Emacs has a built-in tutorial as well: C-h t. Want to know more, like working with buffers: GNU Emacs or http://www.emacswiki.org

gert