how to exit vim in ubuntu
Exit Vim in Terminal
Press the Esc key.
You should see the ––INSERT–– label vanish from the lower-left.
To save your changes before you exit, type :w , and then Enter. This will save any changes made. ...
To exit Vi/Vim, type :q and hit Enter.