All topics / Editing in the Terminal

Editing in the Terminal

vim and nano survival: open, edit, save, and (the part everyone fears) quit, without losing your work or your SSH session.

  1. Why edit in the terminal at all On servers and over SSH there's often no desktop and no mouse — the only way to change a file is a terminal editor. nano is the gentle default that shows its shortcuts on screen; vim is everywhere and worth respecting.
  2. nano: the gentle default nano works the way your instincts expect: type to insert, arrow keys to move, and a menu of shortcuts at the bottom of the screen the whole time. Ctrl+O saves, Ctrl+X quits — and it never hides the exit.
  3. vim: the mode that traps everyone, and the way out vim's one big idea is modes: normal mode (keys are commands) and insert mode (keys are text). Press Esc to get to normal, then :wq to save and quit or :q! to quit and throw everything away. That's the escape.