Commenting multiple lines in a file with vi editor

From command mode, type
: n1,n2s/^/#/
n1, n2 are the first and last line that need to comment
example: comment from line 10-20 use
: 10,20s/^/#/
And to uncomment, we use
: n1,n2s/#/

Comments

Popular posts from this blog

Install Nginx With PHP And MySQL On CentOS 7

Some common php modules

Redirect all unencrypted traffic to HTTPS in Apache