Vi

Vi (visual editor) is a text editor that is available on most Unix-based operating systems. It has two modes, command mode and insert mode. In command mode, the user can navigate the document and perf

Opening a file in Vi:

vi filename.txt

Switching between command mode and insert mode:

i (insert mode)

Esc (command mode)

Saving changes and quitting Vi:

:wq  (write changes and quit)
:x   (same as :wq)
:q!  (quit without saving changes)
h  (move left)
j  (move down)
k  (move up)
l  (move right)

Searching for text in command mode:

/keyword   (search forward for "keyword")
?keyword   (search backward for "keyword")
n          (go to next occurrence)
N          (go to previous occurrence)

Last updated