Comment and Uncomment multiple line in vi terminal editor

Commenting Multiple Lines

Follow the steps given below for commenting multiple using the terminal.

  1. First, press ESC
  2. Go to the line from which you want to start commenting. Then, press ctrl + v, this will enable the visual block mode.
  3. use the down arrow to select multiple lines that you want to comment.
  4. Now, press SHIFT + I to enable insert mode.
  5. Press # and it will add a comment to the first line. Then press ECS and wait for a second, # will be added to all the lines.

Uncommenting Multiple Lines

  1. Press CTRL + V to enable visual block mode.
  2. Move down and select the lines till you want to uncomment.
  3. press x and it will uncomment all the selected lines at once.
  •  
  •  
  •  
  •  
This entry was posted in   Linux and tagged   .
Bookmark the   permalink.

Viet Luu has written 212 articles

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

We are thankful for your never ending support.