Home >Operation and Maintenance >Linux Operation and Maintenance >How to delete multiple lines in linux
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.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
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!