Emacs Basics

By Xah Lee. Date: . Last updated: .

Using Menu

Emacs by default supports mouse and menu.

emacs menu 2021-07-19
Emacs menu.

The keyboard shortcuts are shown beside the menu.

So, use menu, and you can learn the keyboard shortcuts.

Using Emacs in Text Terminal

The following is a tutorial covering the basics for using emacs by keyboard only.

Using emacs with only keyboard is critical to many programers, because one important use of emacs is working on remote machine via text terminal.

Start Emacs

# start emacs in text terminal
emacs --no-window-system

# On Mac OS X
/Applications/Emacs.app/Contents/MacOS/Emacs --no-window-system

# Windows, example, from PowerShell
c:/Users/xah/Downloads/emacs-27.1-x86_64/bin/runemacs.exe --no-window-system

Start emacs and open a file:

# open a file with emacs
emacs fileName


To undo, press Ctrl+_


To redo, press Ctrl+g then do a undo Ctrl+_. Further undo will all be redo. Press Ctrl+g to reverse direction again.


To save file, press Ctrl+x Ctrl+s.

Quit Emacs

Press Ctrl+x Ctrl+c.

Quit without Saving

To quit without saving, just do quit and emacs will ask if you want to save.

If the keys you press seem to do weird things, then, press Ctrl+g. This will cancel the sequence of keys you may have pressed by mistake.

Congratulations! You are now a Emacs Master!

With the above, you can edit any text file. Now, you can learn how to do search, find/replace, and new shortcuts for efficient navigation. Goto Emacs Keys.

Spent a few hours here?

Emacs Tutorial

Emacs Init

Emacs Keys

Elisp Basics

Elisp Examples

Elisp Advanced

Elisp Write Major Mode

Emacs Tutorial

Quick Start

Manage Windows



Find Replace




Rectangle Edit

Line Wrap


View Special File

Editing Brackets

Org Mode


Emacs Efficiency