Linux Commands vi vim and Unix Command gvim

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

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'

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 commands and keybindings that are specific to the mode. It also offers a visual mode for marking blocks of text.

Vim editor

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 can 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 many circumstances, vi is merely an alias for vim. You'll most often see old-school vi in recovery environments and bare-bones server installations.

The 'gvim' Editor

The gvim editor is vim inside a GUI window, with a menu and toolbar system taking the place of the 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.

Was this page helpful?