Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to delete multiple lines by linux

Shulou Source: shulou.com Published: 2022-05-31 11:20:37 10月01日 Update

Most people do not understand the knowledge points of this article "linux how to delete multiple lines", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "linux how to delete multiple lines" article.

Linux delete multiple lines of the method: 1, in the command mode, the use of ": set nu" command to display the line number; 2, enter ": start to delete line number, end delete line number d", press enter to delete multiple lines of data, including the start and end line.

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

How to delete multiple lines by linux

1. Multiline comments:

1. First press esc to enter the command line mode, press Ctrl + v to enter the column (also known as block) mode

two。 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 (uppercase) "I" key to enter insert mode

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

5. Finally press the "Esc" key.

Note: after pressing the esc key, it will wait a while before the comment appears. Don't worry ~ the time is very short.

two。 Delete multiline comments:

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

two。 Select multiple lines to uncomment

3. Press "x" or "d".

Note: if it is a "/" comment, you need to do it twice. If it is a "#" comment, you can do it once.

3. Multi-line deletion

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

two。 Determine the line you want to delete by the line number

3. Enter the command ": 32jue 65d", enter key, line 32-65 will be deleted, quickly

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

The above is about the content of this article on "how to delete multiple lines in linux". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Tags: Multiline mode comment command content line number input enter key article knowledge article start line worry up and down value block uppercase most just Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info MariaDB NVidia Docker MySQL