VIM for Beginners: The Essential Guide
Vim is a powerful terminal editor that feels strange at first because it has modes. You start in normal mode where keys act as commands, press i to type, and press Esc to go back. To save and quit, type :wq. This guide teaches just enough to survive your first session.
Open a file
Run vim with the file name. Newcomers often get stuck because vim opens in normal mode, where letters are commands, not text.
The modes
Normal mode is the default: keys like j and k move the cursor down and up. Insert mode is for typing. Toggle between them with i to insert and Esc to return to normal mode.
Save and quit with :wq
Colon commands run from normal mode. :w saves, :q quits, and :wq saves and quits together. If you made changes you want to discard, :q! quits without saving.
Move and edit
In normal mode, h j k l move left, down, up, right; x deletes the character under the cursor; dd deletes the whole line; u undoes. Press i to type new text.
Search and quit help
Press / in normal mode, type a word and press Enter to search. Press n for the next match. When you are lost, run :help — and remember the modern escape hatch :q!. If vim feels like too much, nano is the friendly alternative. See vim for the essentials.
Keep learning
Related guides: The Nano Text Editor: A Beginner's Guide · How to Use the sed Command for Text Editing · Linux Redirection and Pipes: A Practical Guide. Read all tutorials on the Learn Linux blog.