The VI editor (short for Visual Editor) is a full-screen, display-oriented text editor available on virtually all Unix, Linux, and POSIX operating systems. Originally developed by Bill Joy in 1976 for BSD Unix, it remains an indispensable tool for Linux system administrators, DevOps engineers, and C/Python programmers worldwide.
Once you learn VI's touch-typing workflow, you will find it is one of the fastest, most lightweight, and powerful editors in existence. Unlike GUI code editors, VI has no graphical buttons or menus; instead, it uses efficient combinations of mnemonic keystrokes to accomplish complex editing commands without ever lifting your hands off the keyboard.
Figure 1: State transitions between Command, Insert, and Last-Line (Ex) Modes in VI editor.
Most text editors (such as Notepad, Microsoft Word, or Nano) are modeless: whenever you press an alphanumeric key, that character is immediately inserted into the document. To move the cursor or delete text, you must use arrows, the mouse, or hold down awkward modifier keys like Ctrl or Alt.
VI solves this ergonomic bottleneck through Modal Editing. The keyboard is split into distinct operational modes:
dd deletes a line, yy copies a line, and h, j, k, l move the cursor.i, a, or o from Command Mode. In this mode, every keystroke inputs text into the file just like a regular text editor. Pressing Esc returns you safely back to Command Mode.:) key in Command Mode. The cursor jumps to the bottom status line of the terminal, allowing you to run powerful system commands like saving (:w), quitting (:q), and search & replace (:%s/old/new/g).To launch VI from your Linux terminal prompt, type vi (or vim) followed by the target filename:
$ vi filename.txt
If filename.txt already exists on disk, VI loads a copy of its content into a temporary memory buffer. If it does not exist, VI opens a clean new buffer and will create the file on disk when you issue the save command.
When VI launches with a new file, the terminal displays empty lines prefixed by tilde characters (~). The tildes indicate that those lines are empty and do not yet exist in the file buffer. The bottom line displays the filename, current line count, and character statistics.
Feature |
VI / VIM |
GNU Nano |
GNU Emacs |
|---|---|---|---|
Architecture |
Modal (Command, Insert, Ex modes) |
Modeless (Direct typing) |
Modeless + Lisp extensible environment |
System Availability |
100% Guaranteed (POSIX requirement on all Linux/Unix) |
Common on desktop Linux, missing on minimal servers/containers |
Optional large package; rarely pre-installed |
Memory Footprint |
Extremely lightweight (~2 MB RAM) |
Lightweight (~3 MB RAM) |
Heavy (~50+ MB RAM) |
Ideal Use Case |
Remote server administration, high-speed coding, configuration edits |
Quick casual configuration changes for beginners |
Full Lisp-programmable development IDE |
Practice this fundamental workflow in your terminal:
vi welcome.txt-- INSERT -- at the bottom.Welcome to Linux Programming at Veewom.com!:wq and hit Enter to write changes and quit to the Linux prompt.ls -l welcome.txt && cat welcome.txt.:q! and press Enter. This immediately exits vi without saving any changes.
Learn how Bill Joy crafted VI on the Lear Siegler ADM-3A terminal in Class 8: History of VI Editor.
Continue to Class 8: History of VI → Previous: ← Bash Shell | Full Syllabus