Home  >  Article  >  Operation and Maintenance  >  How to modify file content in linux

How to modify file content in linux

青灯夜游
青灯夜游Original
2021-12-21 16:51:3465896browse

Modification method: 1. Use the "vim file name" command to enter the specified file; 2. Find the location of the content to be modified; 3. After finding the location, press the "i" key on the keyboard to enter the editing state and edit the file content Make modifications; 4. After modification, press the ESC key to exit the editing state and save the modifications.

How to modify file content in linux

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

linux Modify file content

1. Enter the file: vim file name

vim /etc/httpd/httpd.conf

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

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

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

eg Find the Directory parameter, comment out Require all denied, add Require all granted

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

4. Exit after modifying the file content: Press the ESC key

5. Save the changes :

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

(2) Enter wq!

If you do not want to save the changes, you can:

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

(2) Enter q!

Related recommendations: "Linux Video Tutorial"

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