Home > Operation and Maintenance > Linux Operation and Maintenance > How to delete multiple lines in linux

How to delete multiple lines in linux

WBOY
Release: 2022-01-28 11:48:24
Original
10582 people have browsed it

How to delete multiple lines in Linux: 1. In command mode, use the ":set nu" command to display the line number; 2. After entering ":start deleting line number, end deleting line number d", Press the Enter key to delete multiple lines of data including the starting and ending lines.

How to delete multiple lines in linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How to delete multiple lines in Linux

1. Multi-line comments:

1. First press esc to enter the command line mode, press Ctrl v , enter column (also called block) mode;

2. Use the up and down keys at the beginning of the line to select multiple lines that need to be commented;

3. Press the keyboard (capital) "I" key , enter insert mode;

4. Then enter the comment character ("//", "#", etc.);

5. Finally press the "Esc" key.

Note: After pressing the esc key, it will take a while for the comments to appear. Don’t worry~~The time is very short

2. Delete multi-line comments:

1. First press esc to enter the command line mode, then press Ctrl v to enter the column mode;

2. Select the multiple lines to be uncommented;

3. Press "x" or "d".

Note: If it is a "//" comment, you need to perform this operation twice. If it is a "#" comment, just once.

3. Delete multiple lines

1. First, in the command mode, enter ":set nu" to display the line number;

2. Determine by line number The line you want to delete;

3. Enter the command ":32,65d" and press the Enter key. Lines 32-65 will be deleted. It is very quick.

If you accidentally delete the wrong , you can use the 'u' key to restore (in command mode)

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of How to delete multiple lines in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template