Emacs Basics

By Xah Lee. Date: . Last updated: .

Using Menu

Emacs by default supports mouse and menu.

emacs in OS X with GUI menu
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 thru text terminal.

Start Emacs

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

# or
emacs -nw

Start emacs and open a file:

# open a file with emacs
emacs myFileName


To undo, press 【Ctrl+/

To redo, press Ctrl+g then 【Ctrl+/


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

Quit Emacs

Type: 【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.

Like my tutorial? Put $5 at patreon

Or Buy Xah Emacs Tutorial

Or buy a nice keyboard: Best Keyboard for Emacs

Ask me question on patreon