Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How Linux modifies configuration files

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

How does Linux modify configuration files? Many novices are not very clear about this. In order to help you solve this problem, the following small series will explain it in detail for everyone. Those who have this need can come to learn. I hope you can gain something.

Linux adds and modifies configuration files generally using the default VI editor, the command is vi filename. Programmers who edit code for a long time use more powerful editors.

A brief introduction to how to use vi editor:

VI can be divided into three states: command mode and insert mode.

mode) and bottom line mode (last line mode), the function distinction of each mode is as follows:

Command line mode)

Controls movement of the screen cursor, deletion of characters, words or lines, movement of copied sections and entry into Insert mode, or to last line mode.

2. Insert mode

Text input is only possible in Insert mode, press ESC to return to command line mode.

3, bottom line mode)

Save the file or exit vi, you can also set the editing environment, such as looking for strings, listing line numbers, etc.

However, when vi is generally used, it is simplified into two modes, that is, the bottom line mode is also included.

Command line mode).

II. Command line mode function keys

1. Insert mode

Press "i" to switch to insert mode

mode ", press"i"to enter insert mode is to start from the current position of the cursor input file;

Press "a" to enter insert mode, which starts from the next position of the cursor position;

Press "o" to enter insert mode, insert a new line, start typing text from the beginning of the line.

Switch from insert mode to command line mode

Press ESC key.

3. Move the cursor

vi can be moved up, down, left or right directly by using the cursor on the keyboard, but regular vi uses lowercase English letters "h","j","k" and "l" to control the cursor to move left, down, up and right respectively.

VI. Save the command.

Press ESC to jump to command mode, then:

:w Save file without exiting vi

:w file Save the changes separately to file without exiting vi

:w! Forced preservation, no roll-out vi

:wq save file and exit vi

:wq! Force save file and exit vi

q: Do not save files, exit vi

:q! Do not save files, force exit vi

:e! Discard all changes and edit the file from the last time you saved it.

Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report