UnixDroid

Shell · Linux command

vim command in Linux

What does vim do?

vim is a powerful keyboard-driven editor with modes: press i to type, Esc to stop typing, then :wq to save and quit or :q! to quit without saving.

vim file

Most useful options

OptionWhat it does
iinsert mode (type text)
Escback to normal mode
:wsave
:qquit
:wqsave and quit
:q!quit without saving

vim examples

$ vim script.sh Try it ›

edit a script

$ vimtutor Try it ›

the built-in 30-minute tutorial

In security work

Learning the basics of vim is worth it: it is installed on almost every server, even minimal ones.

Questions about vim

How do I exit vim?

Press Esc, type :q! and Enter (quit without saving), or :wq to save and quit.