Contents
Emacs Text Editor
Emacs is a powerful, extensible text editor widely used in HPC environments. Unlike Vim, Emacs is "modeless"—meaning you can type text immediately upon opening a file. It uses complex key combinations (chords) to perform navigation and file operations.
Getting Started
To open a file (or create a new one) in the terminal, use:
$emacs -nw filename.txt
Note: The -nw flag stands for "no window," forcing Emacs to open inside your terminal rather than launching a separate graphical window.
Key Notation
Emacs documentation uses a specific shorthand for keyboard shortcuts:
- C-<key> — Hold Ctrl while pressing the key.
- M-<key> — Hold Meta (usually Alt or Option).
Pro Tip: If you get stuck or half-type a command, press C-g (Ctrl + g) to cancel and reset.
Essential Operations
| Command | Action |
|---|---|
| C-x C-f | Find File (Open or Create) |
| C-x C-s | Save current file |
| C-x C-c | Exit Emacs |
Navigation & Editing
Move faster without leaving the "home row" using these shortcuts:
C-p (Previous Line)
C-b (Back) C-f (Forward)
C-n (Next Line)
C-b (Back) C-f (Forward)
C-n (Next Line)
- C-a / C-e — Move to start / end of a line.
- M-< / M-> — Jump to beginning / end of the file.
- C-k / C-y — Kill (Cut) and Yank (Paste) text.
- C-x u — Undo last change.
HPC Best Practices
- X11 Lag: Always use -nw to prevent graphical lag over SSH.
- Buffers: Use C-x b to switch between multiple open files.
- Recovery: Emacs auto-saves to #file#. Use M-x recover-file if disconnected.
Example Workflow
# 1. Open the file
emacs -nw myscript.py
# 2. Type code, then Save: C-x C-s
# 3. Exit: C-x C-c
emacs -nw myscript.py
# 2. Type code, then Save: C-x C-s
# 3. Exit: C-x C-c
SCU High-Performance Computing Technical Documentation — 2026.