Emacs Basics

By Xah Lee. Date: . Last updated: .

Download Emacs

There are several prepared emacs you can download. See: Download Emacs for Windows, Mac, Linux.

On Mac OS X, emacs is already instealled by default. To launch, goto terminal and just type emacs &.

Using Menu

If you are running emacs in Microsoft Windows or the Mac, just use your mouse and pull menus.

emacs in OS X with GUI menu
Emacs menu.

Remember, real programers don't fear the mouse.

The keyboard shortcuts are shown beside the menu. The “C-x” means 【Ctrl+x】.

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 terminal.

Start Emacs

# start emacs
emacs --no-window-system

# or
emacs --nw

The “--no-window-system” launches emacs directly in the text terminal screen.

# open a file with emacs
emacs myFileName

Save

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, hold down Ctrl then press 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, find/replace, and new shortcuts for efficient navigation. Goto Emacs Key Basics.

Like it? Buy Xah Emacs Tutorial. Thanks.

or, buy something from my keyboard store.