VI has three distinct "modes"
What new users of VI find highly confusing is that the editor has three distinct modes:
The default mode
You can navigate around the document but you cannot change anything.
The edit mode
To switch into this mode you need to press “i” for insert or “a” for append. Now you can edit the content of the document at the point your cursor is. To get out of edit mode you need to press the <escape> key.
The command mode
To enter this mode you need to enter the “:” colon key
Now you can enter one of many many commands that VI has to do actions.
A few really common actions are:
:wq - means write the file and quit
:q! - means quit the file and I don’t care if I have changes - don’t save them.