Course Links

Exercises

Resources

External

Function Emacs Command
Open a file C-x C-f <filename>
Save a file C-x C-s
Quit Emacs C-x C-c
Search for a string C-s <search string>
Search again* C-r
Search and replace Esc x % <search string> <replace string>
Go to a specific line* C-g
Cut an entire line C-k
Cut selected text** C-w
Paste ("yank") most recently cut item C-y
Divide window into two panes C-x 2
Return to single pane C-x 1
Switch between buffers C-x C-b

Notes:

* Works only with modified .emacs configuration file saved in your course home directory. To install it, right-click on the link, select "Save file as," and save it in your home directory with .emacs as the filename. (You must be working at a Linux desktop to do this; if you are using a remote terminal program like SSH you will have to copy and pasted the text.)

** When you run emacs from the command prompt, it is configure to run in terminal mode by default. If you're working at a Linux workstation, you can run emacs in a more flexible window mode. Among other things, this will allow you to use the mouse to select regions of text, move the cursor, select menu items, etc. To start emacs in window mode, type emacs in quotes at the command prompt, with an & to indicate that the program should run in the background rather than waiting for it to finish before accepting another command.

$ "emacs" &
$ "emacs" myfile.cpp &

Emacs will pop up a fresh window on the desktop each time you run this command. If you would like to limit the number of separate windows on your desktop, you should open subsequent files within Emacs using the C-x C-f command given above. You can switch between multiple open files using the mouse (on a Linux desktop) or via C-x C-b.