26 Dec Editing files in SSH using VI
Posted at 01:29h in Blog 0 Comments
Expertise level: Easy
VI is a text editor that can edit most of the files under a Linux architecture (text files, php, etc.).
To open a file in VI editor, type the following:
For a file named test.txt, it would b:
Once the file has been opened, press the “insert” key on your keyboard to enter edit mode.
The “Esc” key will allow you to leave the edit mode, but not the VI editor.
Here is the list of frequently used commands necessary to use the VI editor:
- :q! : Forces the editor to exit without saving.
- :w : Saves the changes that have been made to the file.
- :wq : Saves the changes that have been made to the file and then exits.
- :# : Where # is a number – Brings you to line number #
- :$ : Brings you to the last line of the file
- :0 : Brings you to the first line of the file
- :/word : This will search for the string “word” in the file. By pressing “n” you can view the other search result.
For more information about vi (and vim), please consult the following website: https://www.vim.org/docs.php
Sorry, the comment form is closed at this time.