Applicable to:
- Plesk for Linux
Question
How to edit a file using the vi utility on Linux?
Answer
-
Connect to a Plesk server via SSH.
-
Install the improved vi text editor:
-
for CentOS/RHEL-based distributions
# yum install vim -y
-
for Debian/Ubuntu-based distributions
# apt-get install vim -y
-
-
Start editing a required file by typing:
Note: If there is no such file, 'vi' will create a new one.
# vi /some_directory/file_name
-
In the text editor, press computer's i key to edit the file.
Doing so will place a document in the "Insert" mode, wherein it is possible to enter text as needed.
You should see -- INSERT -- popup notification at the bottom of the window after pressing the i key.This is a new file▐
~
~
~
~
-- INSERT -- -
After editing the required string or pasting the text, press the Esc button.
This key will place Vim in the "Command" mode. To save the file, type :w and to exit - :qThis is a new file
~
~
~
~
:wThis is a new file
~
~
~
~
:qAlso, it is possible to save and exit by typing :wq
-
To discard the changes, type :q!
This is a new file
~
~
~
~
:q!
Comments
0 comments
Please sign in to leave a comment.