May 6, 2021

Vi Cheatsheet

Vi is powerful, it is also very strange and hard to understand at first. The good news is if you know how to use it, almost any Unix/Linux/BSD will have access to vi even in the most broken system state, so it’s good for recovery when “Bad Things” happen (and they do). You can also use emacs, nano, pico, or a bunch of others. Last I looked, vi is still the most popular, despite its oddities. If you’re using Debian/Ubuntu, install vim (vi improved), it has lots of goodies that might make life easier. Here’s a list of commands you’ll need and what they do:

command what it does
Esc gets you back to where you can enter commands (and not edit the file)
:wq the equivalent of File -> Save in normal programs