Home>Article>Operation and Maintenance> How to locate a certain line in centos
Centos method of locating a certain line: 1. Use ":line number" and the Enter key to quickly locate a specified line; 2. Use "line number gg" to quickly locate a specified line; 3. You can also use "line number G" to locate the specified line. In this case, the G after the line number needs to be capitalized.
The operating environment of this article: centos 7 system, Dell G3 computer.
When using vim, you want to quickly move the cursor to the beginning of the line, the end of the line, the first line, the last line or a certain line. This article briefly introduces this .
1. Quickly go to the beginning of the current line: the home key is the easiest
(1) Home key;
(2) Symbol ^ ( To press shift and 6);
(3) number 0 (numeric keyboard on the left);
2. It is easiest to use the $:end key to quickly go to the end of the current line.
(1) End key;
(2) symbol $ (shift and 4)
(3)n symbol represents the (nth) beginning of the current line -1) End of line;
3. Quickly go to a certain line:
(1) Colon (:) Line number and press Enter;
(2) Line number gg;
(3) Line number G (note capitalization); 0 G or 0 gg is the last line
4. Quickly go to the last line:
(1) Colon (:) $ Enter;
(2) Capital letter G;
(3) shift g;
6. Add a new line of content to the current line:
In normal mode, press the capital letter O to add a new line to the current line (that is, before the content of the current line), and it is Insert Mod );
Recommended tutorial: "centos tutorial"
The above is the detailed content of How to locate a certain line in centos. For more information, please follow other related articles on the PHP Chinese website!