Some Standard Emacs Commands / Keystrokes

« A Completely Random...   Home   Three Steps to... »

C- is your CTRL key. M- is your Meta key, usually ALT or ESC.

Above you hopefully found the typical keystroke / command combinations for Emacs. Emacs has a lot of commands. You fire these commands, or functions, with keystrokes. Which keystroke goes with which function is ultimately up to you. This should not be confusing to anyone who works with Photoshop, Illustrator or any of the Adobe Creative Suite. Emacs uses keyboard shortcuts..... very extensively.

I'm using the abbreviations that you'll see in most text discussing Emacs. In other words M- stands for pressing your "Meta" key. This is usually the Alt key. C- stands for pressing your Control key. So, C-x C-s means hit Control + x then Control + c.

Extended Commands

By hitting M-x you can type in different commands. As you start typing in a command, you'll be able to hit the TAB key to see possible ways to complete your command (hints). For example M-x gomoku let's you play gomoku. M-x fires the execute-extended-command function, which lets you type in the name of a command.... can the name be, execute-extended-command?


You should know that Emacs has a ton of self description and a ton of online reference. In fact  this is the Emacs manual. I find the HTML one page per node version the most useful online and the PDF version the best for leisurely fireside thumbing.

Oh, and you can go look at the key index in the Emacs manual. Additionally the interweb pipes are filled with Emacs Cheat Sheets and Reference Cards. This is a PDF Reference Sheet by CAL CS that's pretty good.

What does this keystroke do?

Ok, this is in the keystroke / commands list, but it's important enough to repeat: To find out what a keystroke combination does in Emacs, type C-h c [THE KEYSTROKES] or C-h k [THE KEYSTROKES]. C-h c is the short info version. It is displayed in the echo area at the bottom of the screen. C-h k is the long info version, and it displays in a window. (C-h K [THE KEYSTROKES] will show the manual area for that command.).

So, if you want to find out what C-z does, you would type C-h k C-z.

Defining your own keystrokes

There may be some keytrokes you wish were defined. For example, M-x goto-line seems very long, so if you want to define C-c g to jump you to the line you enter, then you could add the following line to your init.el file, which is usually in your .emacs.d directory:

(global-set-key "\C-cg" 'goto-line)

These days (since Emacs 22) these sort of customizations (the Lisp commands that are automatically executed when Emacs is started) are placed in the ".emacs.d" directory within the init.el file. They used to be put simply in a ".emacs" file. In fact when Emacs starts it tries three locations: ~/.emacs, ~/.emacs.el, or ~/.emacs.d/init.el.. Here "~" is your home directory.


The same keystroke can have different effects depending on the mode your in. A mode is simply an environment to handle a particular type of text. You can usually see what mode your in by looking at the bar at the bottom of your window. You can pick one major mode and several minor modes. I've tried to only include keyboard shortcuts for the global mode.

A note on terminology

I try to use terminology that'll make sense to people who use things like Word. This terminology isn't always the most accurate. Things like "Copy" and "Paste" don't work exactly the same in Emacs as they do in Word. But I use these terminology short cuts to make things more accessible. Additionally, while most of the keystrokes should work, your sysadmin may have changed some of them (and you can change them back). But finally, I just wanted to provide a quick and easy guide to the typical keystrokes in Emacs. You owe it to yourself to look deeper into Emacs if you anticipate using it often or want to play gomoku.

Final note: Fonts

There are many ways to change fonts. Do yourself a favor and explore "M-x customize-face". It's interactive, and you can choose, "save for future use". If you do this, Emacs will save some Lisp commands to your init.el file, and you'll get a chance to look at them. Additionally, it's not always Emacs fault! For example, if you're using PuTTY to SSH in to a session, then PuTTY will control some aspects of your fonts. For example, PuTTY will controls you FONT SIZE and FONT TYPE! ( Window >> Appearance ). Emacs will still control the colors.

Hopes this collapsible interface helps organize things a little. Let me know if you have any suggestions for keystrokes to add!