To view the vile, type cat filename and press ↵ Enter.

To edit a specific text file with Vi, type vi filename’ instead.

You can’t use your mouse or the arrow keys in Vi. If you make a mistake when typing, you’ll need to run a command in command mode. Press Esc to make the arrow keys available, use them to move the cursor to the location of the mistake, and then use any of these commands: x deletes the character under the cursor. dw deletes the current word. dd deletes the entire line. r replaces the letter under the cursor with the next one you type. This will automatically put you back into input mode after use. See How to Learn Vi to learn about more Vi commands.

If you want to keep editing the file, press i to go back into input mode. The next time you want to save the file, you can just type :w in command mode (no file name necessary).

Use the full path to the file if you’re working with files outside of the current working directory (e. g. , cp /home/maria/textfile1 /home/maria/contracts/textfile2).