emacs foo.c&in a command window, if you are at a console, or
emacs foo.cif you are using telnet.
I will write ^X for the keystroke that is done by holding down the control key while typing X (or x). I will write esc for the escape character.
Some commands are just a single keystroke, but some require more than one keystroke. For example, command ^X ^C (the command to quit the editor) consists of a control-X followed by a control-C.
backspace Do a backspace. ^D Delete one character (forward). ^A Move to the start of the current line. ^E Move to the end of the current line.
^V Scroll down one page. esc v Scroll up one page. ^X < Go to the start of the buffer. ^X > Go to the end of the buffer.
^X ^S Save the current file. ^U ^X s Save all modified files.You can open a file without closing the one that you are working on.
^X ^F Find (open) a file. You will be asked for the name of the file in the minibuffer. ^X 4 ^F Find (open) a file in another window. Emacs splits the current window, so that you can see two files. ^X o Switch to the other window.You can switch to another buffer that you already have open.
^X b Switch to another buffer. You will be prompted for the name of the buffer, with the default being the most recently hidden buffer. ^X ^B List all buffers. Go to the window that shows the buffers. Typing f while on a line in that window will take you to that buffer. Typing o will take you to that buffer in the other window.
^(space) Mark the current buffer position. ^W Cut (wipe) the text between the current cursor position and the most recently set mark, and put it on the clipboard. esc w Copy the text between the current cursor position and the most recently set mark to the clipboard. ^K Cut the part of the current line from the current cursor position to the end, and put it on the clipboard. (If the line has no text on it, the line is cut.) ^Y Paste (yank) what is on the clipboard to the current cursor position.Emacs actually has a powerful cut/paste facility. If you do several cut or copy commands in a row, each one adds to what is already on the clipboard. Emacs keeps several clipboards in what is called the kill ring. When a new clipboard is started, the old one is pushed onto the kill ring. This allows you to get former clipboard contents.
esc y When done after a ^Y, this replaces what what was just pasted with the former clipboard contents. The old clipboard contents is moved to the bottom of the kill ring. Doing several esc Y commands in a row allows you to go through the entire kill ring.
^S Search for text. You type the text into the minibuffer. As you type, the search will be performed, based on what you have typed so far. Type ^S during the search to skip ahead to the next match. The search stops when you type return. If you reach the end of the buffer, type ^S again to continue the search from the front of the buffer. ^S ^S Repeat the previous search. ^R Search backwards. esc % Perform a substitution. You will be prompted for the string to replace and what to replace it with. For each occurrence, you will be asked whether to replace that occurrence. Type y to replace n to skip q to stop the command
^H k Describe the command to which a given key sequence is bound. Type the key sequence after ^H c. ^H f Describe a given function. You type the function name. ^H t Give a tutorial on Emacs. ^H ^H ^H Describe available help commands.
^X ( Begin recording a keyboard macro. ^X ) End recording a keyboard macro. ^X e Execute the last keyboard macro. This consists of the sequence of keystrokes between ^X ( and ^X ).
^X ^C Exit emacs. ^G Abort a command.
c-mode Put the editor into C mode. The tab key indents the current line. Braces self-indent, and a right brace shows you the matching left brace, which is very useful. c++-mode Put the editor into C++ mode. This is similar to C mode. fundamental-mode Put the editor into its default mode. goto-line Goto a given line number. shell Open a shell window. This is useful when running through a telnet connection.You only need to type as much of the command as is necessary to distinguish it from other commands. Typing fund, for example, is enough to get command fundamental-mode. There are many more commands. You can learn some from the ^H t tutorial.
^Z Zap the current line. This cuts the current line and puts it on the clipboard. Several zaps in a row accumulate lines on the clipboard. ^B Scroll up one line. ^F Scroll down one line. esc G Same as goto-line. esc R Replace string. Like esc %, but does not ask at each replacement. It just does them all.Additionally, the current line number will be displayed in the status line. Read the .emacs file to see a little more on customizing.