Linuxlab

Text editors in Linux: nano and vim

Updated July 3, 2026

nano and vim are text editors right in the terminal; nano is easier to start with, vim is on almost every machine.

Common cases

nano file.txt        # open a file in nano
# in nano:  Ctrl+O save, Ctrl+X quit
vim file.txt         # open a file in vim
# in vim:   i insert, Esc back, :w save, :q quit, :wq both
vim -R file.txt      # read-only

How it works: vim's modes and how to quit

nano works like a familiar editor: open it, type, and the hints at the bottom use Ctrl. vim is built around modes, and that trips people up. When it opens you are in normal mode: letters are commands, not text. Press i to start typing, and Esc to go back. The most common question is how to quit: press Esc, then type :q and Enter (or :q! to quit without saving, :wq to save and quit). If the editor is unfamiliar, use nano.

In the book

This topic is covered in full in the chapter Reading and editing text.

See also

cat, head, tail, The less pager.