GNU Emacs is an extensible text editor whose behavior can be customized with Emacs Lisp. It supports plain-text editing, programming modes, file and buffer management, and many optional packages. You can learn its core editing commands without adopting every extension.
Advanced Text-Fu · Lesson 9
Emacs
Learn how to start Emacs, interpret its key notation, and distinguish buffers, windows, and frames.
Checking and Starting Emacs
Do not assume Emacs is installed. Check how the shell resolves it:
$ command -v emacs
/usr/bin/emacs
Start Emacs with its normal display selection:
$ emacs
In a graphical session this may create a graphical frame. Use -nw, short for no window system, when Emacs should remain inside the current terminal:
$ emacs -nw
Which command starts Emacs inside the current terminal instead of using a graphical window system?
Opening a File
Pass a pathname to visit a file when Emacs starts:
$ emacs notes.txt
If the file exists, Emacs reads it into a buffer. If it is missing, Emacs creates a new buffer associated with that pathname; the file is created only after a successful save. Filesystem permissions still determine whether a write can succeed.
What does emacs notes.txt normally do when notes.txt does not yet exist?
Understanding Buffers, Windows, and Frames
Emacs uses related but distinct objects:
- A buffer holds text or other editor state. A visited file's content lives in a buffer.
- A window is an area within an Emacs frame that displays a buffer.
- A frame is a top-level Emacs display, such as a graphical frame or terminal frame.
Several buffers can exist without being visible, and two windows can display the same buffer. Closing a window does not necessarily kill its buffer or delete a file.
What is an Emacs buffer?
Reading Emacs Key Notation
Emacs documentation uses compact notation:
C-xmeans hold Control and pressx.M-xmeans hold Meta and pressx; Alt commonly acts as Meta in modern terminals and desktops.C-x C-fis a key sequence: press Control+x, then Control+f.
The exact terminal may intercept or remap some keys. Esc followed by a key can often stand in for a Meta chord.
How do you enter the Emacs key sequence written C-x C-f?
Starting the Built-In Tutorial
Inside Emacs, type C-h t to open the interactive tutorial. It teaches movement, insertion, saving, and quitting in a safe practice buffer. C-h is the help prefix; C-h C-h shows help about using help.
If Emacs displays a menu or welcome buffer, the tutorial remains the better structured starting point than experimenting on an important file.
Which Emacs key sequence opens the built-in tutorial?
Lesson complete
You finished Emacs
You can now start Emacs and interpret its foundational interface concepts.
Check whether the
emacscommand is available.Choose graphical or terminal operation with
-nw.Visit an existing or new pathname in a buffer.
Distinguish buffers, windows, and frames.
Read key notation and open the built-in tutorial.
Keep your learning progress
Create a free account to save this lesson and continue learning on any device.
Create a free account