In terminal go to your desired filepath
Then type following command to start editing your file
vi filename.ext
This shall open the editor and you will see multiple lines with tilde(~) symbol
Next you will need to press i to start actually typing into file (untill then you are in read mode)
Now type your contents
Press esc and type :
This allows you to enter commands to vi editor
For saving and closing the editor you will type wq and press enter
To avoid saving you can type q!
Remeber when you press esc you again enter into readonly mode, and you can use arrow keys to move inside document.
Other main operations are
1) Copy
Go to line that you wish to copy
Press esc, Press yy to copy single line
Note: To copy 3 lines you can say y3y and so on
2) Cut
Go to line that you wish to cut
Press esc, Press dd to cut single line
Note: To cut 3 lines you can say d3d and so on
3) Paste
Go to line after which you wish to paste content from above two commands and press p
4) Search string
Press Esc
Type / followed by string you wish to find
Ex. /hello
.... Will add more as I recall