To open or create a file using Vim, run the following command, then press i to insert text into it (insert mode):
$ vim file.txt
OR
$ vi file.txt
Press ‘i’ to Insert Mode in Vim Editor
Once you have modified a file, press [Esc] shift to the command mode and press :w and hit [Enter] as shown below.
To save the file content to a new file named newname, use :w newname or :x newname and hit [Enter].

