Table of Contents
Debian text editors
Debian provides several text editors with different learning curves and capabilities.
nano
Beginner-friendly, simple modal editor. Starts in edit mode:
nano file.txt
Common commands (Ctrl prefix):
Ctrl+X: exitCtrl+O: saveCtrl+W: searchCtrl+U: undoCtrl+V: next page
Quick, non-destructive, forgiving. Good for quick edits and scripts.
vi/vim
Powerful but steep learning curve. Three modes:
- Normal (default): navigation and commands
- Insert (press
i): edit text - Command (
:): file/search commands
Basic workflow:
vim file.txt i # enter insert mode [edit text] Esc # back to normal :wq # save and quit :q! # quit without saving
Useful normal mode commands:
dd: delete lineyy: copy linep: paste/pattern: search:%s/old/new/g: replace all
Vim has syntax highlighting, text objects, macros, and extensive customization.
emacs
Extensible, powerful, but also steep. Heavy Ctrl usage. Start:
emacs file.txt
Commands:
Ctrl+X Ctrl+C: exitCtrl+X Ctrl+S: saveCtrl+S: searchCtrl+_: undo
Less common on systems without X11; vim is usually available everywhere.
ed
Minimal line editor, rarely needed:
ed file.txt
Useful only when nothing else available (embedded systems, minimal recovery).
Choosing an editor
Set default editor:
export EDITOR=vim export EDITOR=nano
Used by crontab -e, visudo, and many tools. Pick one and learn it:
- Quick edits →
nano - Programming →
vim - Extensive config →
emacs
For shell scripts: vim with syntax highlighting makes debugging easier. For one-liners: nano is faster.
