Linux Emacs Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Linux Emacs Guide
Complete beginner-friendly guide to Emacs text editor on Linux, covering Arch Linux, CachyOS, and other distributions including installation, basic usage, and configuration.
Table of Contents
Emacs Installation
Install Emacs
Arch/CachyOS:
# Install Emacs
sudo pacman -S emacs
# Or GUI version
sudo pacman -S emacs-nox
Debian/Ubuntu:
sudo apt install emacs
Fedora:
sudo dnf install emacs
Launch Emacs
Start Emacs:
# Open file
emacs filename.txt
# Or GUI
emacs
# Terminal version
emacs -nw filename.txt
Emacs Basics
Interface
Emacs display:
- Top: Menu bar
- Middle: Text area
- Bottom: Status line (mode line)
Basic Editing
Edit text:
- Type: Start typing
- Move cursor: Arrow keys or Ctrl+arrow
- Delete: Backspace or Delete
⌨ Emacs Commands
File Operations
File commands:
- Ctrl + X, Ctrl + S: Save
- Ctrl + X, Ctrl + W: Save as
- Ctrl + X, Ctrl + F: Open file
- Ctrl + X, Ctrl + C: Exit
Navigation
Move around:
- Ctrl + F: Forward character
- Ctrl + B: Backward character
- Ctrl + N: Next line
- Ctrl + P: Previous line
- Ctrl + A: Beginning of line
- Ctrl + E: End of line
Editing
Edit commands:
- Ctrl + D: Delete character
- Ctrl + K: Kill line
- Ctrl + Y: Yank (paste)
- Ctrl + Space: Mark text
Emacs Configuration
Configuration File
Edit config:
# Edit init file
vim ~/.emacs
# Or
vim ~/.emacs.d/init.el
Common Settings
Configuration:
;; Enable line numbers
(global-linum-mode t)
;; Enable syntax highlighting
(global-font-lock-mode t)
;; Set tab size
(setq-default tab-width 4)
Troubleshooting
Emacs Not Starting
Check installation:
# Check Emacs
which emacs
emacs --version
# Install if missing
sudo pacman -S emacs
Summary
This guide covered Emacs installation, basic usage, and configuration for Arch Linux, CachyOS, and other distributions.
Next Steps
- Text Editors - Text editors
- Vim Guide - Vim editor
- Emacs Documentation:
man emacs
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.