This command allows you to create new files, or to open and edit existing files.
Simply type the command vi followed by the name of the new file or the name of any existing file you want to edit.
if you want to create a new file called "mynewfile", simply type vi mynewfile.
[joe@server htdocs]$ vi mynewfile
Note that the new file is created in the present working directory. This means that if you are at /home/joe/htdocs,
then the file mynewfile is created there.
If you want to open the file called "old", you can either type the command vi followed by the full path to the file called "old", OR you get to the directory where the file "old" is, then type the command followed by the filename.
Let's say the file "old" is at /usr/local/bin, you can do type the full path...
[joe@server htdocs]$ vi /usr/local/bin/old
...you can get to the directory first, then type vi old ...
[joe@server htdocs]$ cd /usr/local/bin
[joe@server bin]$ vi old
How to edit the opened or created file
1. First, press "i". At the bottom of the window, you should then see the word "--INSERT--".
2. Move the cursor around by using the arrow keys.
3. Add new words by typing.
4. Delete words by pressing "Backspace" keys.
5. When you are done, press "Ecs".
6. To quit without saving, type :q! (the characters :q! should apprear at the bottom of the window.), and press "Enter".
7. To quit with saving, type :wq! (the characters :wq! should apprear at the bottom of the window.), and press "Enter".