GNU Emacs keyboard shortcuts

GNU Emacs uses Control and Meta key notation for movement, editing, files, buffers, windows, search, help, and keyboard macros. Prefix commands are shown in press order rather than as one chord.

Windows, macOS, Linux · 62 shortcuts

Movement

These default editing commands move by character, word, line, sentence, screen, or buffer.

ActionWindowsmacOSLinux
Move forward one characterCtrlFCtrlFCtrlF
Move backward one characterCtrlBCtrlBCtrlB
Move to the next lineCtrlNCtrlNCtrlN
Move to the previous lineCtrlPCtrlPCtrlP
Move to the beginning of the lineCtrlACtrlACtrlA
Move to the end of the lineCtrlECtrlECtrlE
Move forward one wordAltFOptionFAltF
Move backward one wordAltBOptionBAltB
Move to the previous sentenceAltAOptionAAltA
Move to the next sentenceAltEOptionEAltE
Scroll forward one screenCtrlVCtrlVCtrlV
Scroll backward one screenAltVOptionVAltV
Move to the beginning of the bufferAlt<Option<Alt<
Move to the end of the bufferAlt>Option>Alt>
Go to a lineAltGthenGOptionGthenGAltGthenG

Editing and regions

Kill commands remove text into the kill ring, while yank commands put it back.

ActionWindowsmacOSLinux
Delete the character at pointCtrlDCtrlDCtrlD
Delete the character before pointGNU documents this as DEL, which is commonly the Backspace key on a modern keyboard.DELDELDEL
Kill to the end of the lineCtrlKCtrlKCtrlK
Kill the next wordAltDOptionDAltD
Kill the previous wordAltBackspaceOptionBackspaceAltBackspace
Kill the active regionCtrlWCtrlWCtrlW
Copy the active region to the kill ringAltWOptionWAltW
Yank the most recent killCtrlYCtrlYCtrlY
Replace the last yank with the previous killAltYOptionYAltY
Set the markCtrlSpaceCtrlSpaceCtrlSpace
Exchange point and markCtrlXthenCtrlXCtrlXthenCtrlXCtrlXthenCtrlX
Mark the entire bufferCtrlXthenHCtrlXthenHCtrlXthenH
UndoCtrl_Ctrl_Ctrl_
Quit the current commandCtrlGCtrlGCtrlG

Files

File commands visit, save, write, revert, and close buffers in the current Emacs session.

ActionWindowsmacOSLinux
Visit a fileCtrlXthenCtrlFCtrlXthenCtrlFCtrlXthenCtrlF
Visit a file read-onlyCtrlXthenCtrlRCtrlXthenCtrlRCtrlXthenCtrlR
Visit a different file in the current bufferCtrlXthenCtrlVCtrlXthenCtrlVCtrlXthenCtrlV
Visit a file in another windowCtrlXthen4thenFCtrlXthen4thenFCtrlXthen4thenF
Visit a file in another frameCtrlXthen5thenFCtrlXthen5thenFCtrlXthen5thenF
Save the current bufferCtrlXthenCtrlSCtrlXthenCtrlSCtrlXthenCtrlS
Write the buffer to a new fileCtrlXthenCtrlWCtrlXthenCtrlWCtrlXthenCtrlW
Save some modified buffersCtrlXthenSCtrlXthenSCtrlXthenS
Execute a named commandAltXOptionXAltX
Quit EmacsCtrlXthenCtrlCCtrlXthenCtrlCCtrlXthenCtrlC

Buffers and windows

Switch buffers, split or remove windows, and move between windows with these prefix commands.

ActionWindowsmacOSLinux
Switch to a bufferCtrlXthenBCtrlXthenBCtrlXthenB
Switch to a buffer in another windowCtrlXthen4thenBCtrlXthen4thenBCtrlXthen4thenB
Switch to a buffer in another frameCtrlXthen5thenBCtrlXthen5thenBCtrlXthen5thenB
Kill a bufferCtrlXthenKCtrlXthenKCtrlXthenK
Remove the selected windowCtrlXthen0CtrlXthen0CtrlXthen0
Make the selected window the only windowCtrlXthen1CtrlXthen1CtrlXthen1
Split the selected window horizontallyCtrlXthen2CtrlXthen2CtrlXthen2
Split the selected window verticallyCtrlXthen3CtrlXthen3CtrlXthen3
Move to another windowCtrlXthenOCtrlXthenOCtrlXthenO

Help

The Control-H prefix opens Emacs's built-in command and manual help.

ActionWindowsmacOSLinux
Show active key bindingsCtrlHthenBCtrlHthenBCtrlHthenB
Show the command bound to a keyCtrlHthenCCtrlHthenCCtrlHthenC
Show documentation for a keyCtrlHthenKCtrlHthenKCtrlHthenK
Show documentation for a functionCtrlHthenFCtrlHthenFCtrlHthenF
Search for commands by topicCtrlHthenACtrlHthenACtrlHthenA
Open the Emacs manualCtrlHthenRCtrlHthenRCtrlHthenR
Open the Emacs tutorialCtrlHthenTCtrlHthenTCtrlHthenT

Keyboard macros

Record a sequence of keystrokes and replay it from the keyboard macro commands.

ActionWindowsmacOSLinux
Start recording a keyboard macroCtrlXthen(CtrlXthen(CtrlXthen(
Stop recording a keyboard macroCtrlXthen)CtrlXthen)CtrlXthen)
Run the last keyboard macroCtrlXthenECtrlXthenECtrlXthenE

Make a printable GNU Emacs sheet