Linux Command vi vim — Unix Command gvim

The 'vi' and 'vim' editors are venerable classics; 'gvim' runs in a GUI window

Focused casual businessmen working at computer in sunny office

Tom Merton/Getty Images

Modern Linux distributions ship with one or more default text editors. One of the most common—and one of the oldest—is vi or its variants, vim and gvim.

About 'vi' and 'vim'

Vim editor

The vi editor is a modal editor. It separates a command mode from an insert mode. The program behaves differently depending on the mode, with different command and keybindings that are mode specific. It also offers a visual mode for marking blocks of text.

For example, in command mode, press :wq to save your file and exit the program. The colon indicates a command, the w instructs the editor to write the file, and q instructs the editor to terminate the session.

From command mode, press i to enter insert mode, where you're free to add and modify content. To exit insert mode and access command mode, press Esc.

Check out one of the popular vim cheat sheets for a summary of mode-specific keyboard commands.

Nowadays, the vi editor isn't as common as its vim descendant. In fact, in many circumstances, vi is merely an alias for vim. You'll most often see old-school vi in recovery environments and in bare-bones server installations.

The 'gvim' Editor

gvim

The gvim editor is vim inside a GUI window, with a menu-and-toolbar system taking the place of the sometimes convoluted keystrokes from a shell window.

Although gvim remains available, it's more common to run vim in a shell window, even within the GUI. Other editors, including nano, offer an easier experience for people unskilled with text editors, rather than the sometimes-buggy implementation of the gvim tool.