The Basics of vi

General Information

Right then, vi. “Oh no! vi! That’s command based, can’t use that!” Oh come on, it’s not that difficult! Really… First, I shall explain a little about vi. vi (now mostly vim) is one of the oldest text editors for *nix. It can be found on many systems, both UNIX and Linux, and is usually the default editor. vim (VI iMproved) is beginning to take over from the older vi, but essentially, they function the same way.


  1. Access to a server
  2. vi installed


To open vi, you simply type vi at your prompt. To open a file with vi, just type vi followed by the filename, e.g. vi configure.txt.

When you’re in vi, you can’t just start typing; that’s where most people go wrong. When vi opens, it’s (usually) in command mode. You can press either a or i to take vi out of command mode, and you can start typing. Press Esc to re-enter command mode.

When in command mode, you can use the following commands:

Write changes to disk and continue editing.
Write changes to disk and exit.
Exit without saving changes.
Find text in the file.
Go to the end of the file.
Go to line n.
Delete character that the cursor is on.
Delete line (even if it wraps).
Insert text at cursor.
Insert text after cursor.

There are also two key bindings that you need to know for easy navigation of your file:

Forward one page.
Back one page.

That’s all you need to know! Have fun with vi, I promise it’s not too hard.

Speak Your Mind