How To Use Vi On Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Open Vi – open the command line in your terminal and type “vi“. This will open Vi in the home directory of your account.
2. Move around the document – use the arrow keys to move around the document. You can also use the j, k, h and l keys to move up, down, left and right.
3. Edit a document – press “i“ to enter insert mode. From here you can type, paste, delete and more. To save press “Esc“ followed by “:wq“ to write and quit.
4. Copy and Paste – press “Shift+v“ to enter visual mode. This allows you to select lines with the arrow keys. Press “y“ to copy them, or “d“ to cut them. To paste, press “p“.
5. Find and Replace – press “Shift+:” to enter command mode and use the following command: “:%s/old_string/new_string/g“. This will search and replace all occurrences of old_string with new_string.
6. Quit Vi – press “Shift+:” to enter command mode and type “:q!” to quit.