Text Editors
Text Editors (Terminal) — Quick Reference
Section titled “Text Editors (Terminal) — Quick Reference”vim — The Essential One
Section titled “vim — The Essential One”You’ll encounter it on remote servers whether you like it or not. Knowing enough to edit and escape is survival-level knowledge.
| Mode | How to enter | Purpose |
|---|---|---|
| Normal | Esc | Navigation, commands (default) |
| Insert | i, a, o | Type text |
| Visual | v, V, Ctrl+V | Select text |
| Command | : | Save, quit, search, replace |
The Most Important Commands
Section titled “The Most Important Commands”i insert before cursora insert after cursoro insert new line belowO insert new line above
Esc return to Normal mode
:w save:q quit:wq save and quit:q! quit without saving (force):wq! force save and quitZZ save and quit (shortcut for :wq)Navigation (Normal Mode)
Section titled “Navigation (Normal Mode)”h j k l left, down, up, rightw jump to next wordb jump to previous word0 start of line$ end of linegg go to first lineG go to last line:42 go to line 42Ctrl+D page downCtrl+U page upEditing (Normal Mode)
Section titled “Editing (Normal Mode)”x delete character under cursordd delete (cut) current lineyy yank (copy) current linep paste after cursorP paste before cursoru undoCtrl+R redo. repeat last action
dw delete wordd$ delete to end of linecw change word (delete + insert)Search & Replace
Section titled “Search & Replace”/pattern search forward?pattern search backwardn next matchN previous match
:%s/old/new/g replace all in file:%s/old/new/gc replace all, confirm each:5,10s/old/new replace in lines 5–10Visual Mode (Select Text)
Section titled “Visual Mode (Select Text)”v character-wise selectV line-wise selectCtrl+V block/column select
After selecting:y copyd delete/cut> indent< unindentMultiple Files & Splits
Section titled “Multiple Files & Splits”:e file.txt open file:vsplit file.txt vertical split:split file.txt horizontal splitCtrl+W + arrow move between splits:tabnew file.txt open in new tabgt / gT next / previous tabnano — Beginner-Friendly
Section titled “nano — Beginner-Friendly”Simpler than vim, controls shown at the bottom of the screen.
nano file.txt| Shortcut | Action |
|---|---|
Ctrl+O | Save (Write Out) |
Ctrl+X | Exit |
Ctrl+K | Cut line |
Ctrl+U | Paste line |
Ctrl+W | Search |
Ctrl+\ | Search and replace |
Ctrl+G | Help |
Alt+U | Undo |
- Memorize
:wqand:q!first — everything else is secondary. vimtutor(run in terminal) is an interactive 30-minute lesson built into vim itself.- Use
nanowhen you just need to make a quick edit and don’t want to think about modes. - On most servers, if
vimisn’t available,vi(its predecessor) almost certainly is — the core commands are the same.