A few days ago I needed to use vi for a simple change in a single file. However, I am not using vi in normal situations since I prefer the usage of “nano“. Since I only needed to edit a few lines, all the command references I found on the Internet were much to overwhelmed, so I decided to write a really tiny vi tutorial which only shows the commands in order to edit a file and to close it afterwards. Here we go:
Open the file with vi textfile.
Go into the edit mode with “i” and edit the text. When you are finished, hit the Esc key to leave the edit mode. Type a colon followed by an “x” (appears at the bottom line) to quit vi with saving the changes. Thats it. Here is the sequence at a glance:
<Edit the text>
If you want to quit vi without saving, type a “q!” instead of the “x”.
For german people: If the keyboard setting of the Linux machine is not the german one, you’ll find the colon on shift+ö ;)