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

Web Servers Load balancing with HAProxy

Redirect all unencrypted traffic to HTTPS in Apache

Using nginx as http load balancer