Using ‘vim’ to create and edit a file
- Log into your server via SSH.
- Navigate to the directory location you wish to create the file, or edit an existing file.
- Type in vim followed by the name of the file. For example, if you wish to create (or edit) a new file named test.html, run the following:
[server]$ vim test.html
- The ‘vim’ editor may appear confusing at first because you cannot type into the file yet:
- Click the letter ‘i‘ on your keyboard to enter INSERT mode in ‘vim’.
- It now shows — INSERT — on the bottom left:
- Start typing into the file.
- When finished editing the file, click the ESC key. This takes you out of INSERT mode and — INSERT — disappears from the bottom left of your terminal.
- To save the file, type in a colon followed by wq. For example:
:wq
- The characters :wq appear on the bottom left:
- Click the ‘Enter’ key on your keyboard to save.



