Home  >  Article  >  Operation and Maintenance  >  How to modify files in centos

How to modify files in centos

王林
王林Original
2020-03-17 13:32:4012018browse

How to modify files in centos

[1] Modify the file

If you log in as a normal user, you need to switch to the administrator user first, open the terminal, enter: su, and then follow the prompts. Just enter the password; then use the command to enter the directory where the file needs to be modified. Several commonly used commands are as follows:

① cd directory name

② cd ​​space (return to the upper directory)

③ cd space/(return to the highest level directory)

(recommended tutorial: centos usage tutorial)

Then use the command: vi file name command to open the file, Then enter the command: / Keywords to be modified, find the content to be modified, and then use the command to enter [Text Input Mode]. Commonly used commands are as follows:

① a Start inputting text after the cursor

② A Start inputting text at the end of the line

③ i Start inputting text before the cursor

④ I Enter text before the first non-blank character at the beginning of the line

⑤ o Insert a blank line after the line where the cursor is

⑥ O Insert a blank line before the line where the cursor is

[2] Save and exit

After modifying the file, if In [Text Input Mode], first press the "ESC" key to enter [Command Mode], then enter ":" to enter [Last Line Mode]. In Last Line Mode, you can use the following exit command:

① q is to exit directly;

② wq is to exit after saving;

③ q! is to force exit;

④ wq! is to force save and exit;

Related video tutorial sharing: linux video tutorial

The above is the detailed content of How to modify files in centos. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn