Using Vi from the terminal window to edit files

Basic Cursor use

  • k Up one line
  • j Down one line
  • h Left one line
  • l Right oen character (or spacebar)
  • w Right one word
  • b Left oen word


  • i Enter text entry mode
  • x Delete one character
  • dd Delete a whole line
  • r Replace a single character
  • R Overwrite text, <esc> to end


* To exit you must be in command mode-press <esc> if you are not in command mode * You must press <return> after commands that begin with a : (colon)
  • ZZ Write (if there were changes), then quit
  • :wq Write, then quit
  • :q Quit (will only work if file has not been changed)
  • :q! Quit without saving changes to file