Home  >  Article  >  Operation and Maintenance  >  How to modify the content of linux files

How to modify the content of linux files

青灯夜游
青灯夜游Original
2022-03-24 17:46:356870browse

Modification method: 1. Use the "vim file name" command to enter the file; 2. Press the "shift ":"" key to enter the query state, and enter the "/query content" command to find the content location; 3. Press The "i" key enters the editable state and edits the file content; 4. Press the "ESC" key to exit the editing state; 5. Use the "wq!" command to save the changes.

How to modify the content of linux files

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

How to modify the content of linux files

1. Enter the file: vim file name

Example: vim /test/vi.test

How to modify the content of linux files

When you first open the file, Vim is in command mode. At this time, some information about the file will be displayed below the file. , including the total number of lines and characters of the file, as well as the current cursor position, etc.

2. Find the location of the content to be modified:

(1) shift ":", make the file queryable

(2) Enter /query content (eg query Directory parameters, that is, /Directory)

3. Modify after finding the location: Press the i key on the keyboard to become editable

4. After modifying the file content, Press the ESC key to exit the editing state

5. Save changes:

Enterwq!

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of How to modify the content of linux files. 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