{"id":602,"date":"2012-03-25T02:03:30","date_gmt":"2012-03-25T08:03:30","guid":{"rendered":"http:\/\/blog.supportpro.com\/?p=602"},"modified":"2026-06-22T02:53:55","modified_gmt":"2026-06-22T08:53:55","slug":"commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/","title":{"rendered":"How to Comment Multiple Lines in VI\/Vim in a Single Step"},"content":{"rendered":"<p>A text editor like vi or vim can be used to comment multiple lines in a shell script (or any other script or configuration file) in a single go rather than adding # or whatever that goes for a comment for the script in question.<\/p>\n<p>Open the file to be edited using vi\/vim using the command vi filename (where filename can be replaced by the name of the file). Now enter command mode by pressing: In order to comment multiple lines ( i.e. to add a # to the beginning of the line), say lines from 5 to 10 in the script, type the command<br \/>:5,10s\/^\/#\/ #: in the command is part of entering the editing\/ex mode in vi.<\/p>\n<p>Note#: The command: set nu can be used to view line numbers in vi\/vim<br \/>Clarification<br \/>General Syntax<br \/>==============================================<br \/>:%s\/r1\/r2\/ is the syntax used for string substitution in vi\/vim<br \/>Syntax split<br \/>: Enter command mode<br \/>% Perform the command on all lines<br \/>s Short form for: substitute command<br \/>r1 Can be replaced with any string in the script\/file that is to be replaced<br \/>r2 Can be replaced with any string which should replace the string r1 in the script\/file<br \/>\/ Used as a separator<br \/>Changes from syntax in the executed command<br \/>============================================<\/p>\n<p>In the command that we used for substitution\/adding comments to lines starting from 5 to 10<br \/>% has been replaced with 5,10 so that the command will be executed only for lines starting from 5 to 10<br \/>^ caret [^ ] matches the position before the first character in the string (hence in the command that we executed, the substitution takes place for the position before the first character[=r1])<br \/># Replacement for r2 in syntax (i.e. # is used as the character\/string which substitutes r1[position before the first character])<\/p>\n<h3>Comment removal<\/h3>\n<p>In order to uncomment multiple lines (we will remove # from the lines that we have commented, i.e. from 5 to 10) we can use the command<br \/>:5,10s\/^#\/\/<br \/>Clarification<br \/>^# Matches all characters starting with # (since ^ means position before the first character, ^x [x can be replaced with any character which does not hold a special meaning in bash, or \\x if x has got a special meaning] will match any line which has got x as the character at the first character)<br \/>\/\/ Two \/s without any in between space :: hence substitution will completely remove # from the beginning without adding anything<br \/>Commenting all lines in a script\/file<br \/>Open the file in vi\/vim and use the command<br \/>:%s\/^\/#\/g<\/p>\n<p>g stands for global (so that the substitution will occur globally, i.e. for all lines in the script)<br \/>All the rest have already been explained in General Syntax<br \/>Note: For php files which treat ; as the commenting character instead of # , # can be replaced with ; i.e. for commenting all lines in a php file we can use the command %s\/^\/;\/g<\/p>\n<p>If you require help, <a href=\"https:\/\/www.supportpro.com\/requestquote.php\">contact SupportPRO Server Admin<\/a><\/p>\n<p style=\"text-align: center;\"><!--HubSpot Call-to-Action Code --><span id=\"hs-cta-wrapper-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-wrapper\"><span id=\"hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-node hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\"><!-- [if lte IE 8]><\/p>\n\n\n\n\n\n<div id=\"hs-cta-ie-element\"><\/div>\n\n\n<![endif]--><a href=\"https:\/\/www.supportpro.com\/freecheckup.php\"><img decoding=\"async\" id=\"hs-cta-img-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-img\" style=\"border-width: 0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b.png\" alt=\"Server not running properly? Get A FREE Server Checkup By Expert Server Admins - $125 Value\" \/><\/a><\/span><script charset=\"utf-8\" src=\"https:\/\/js.hscta.net\/cta\/current.js\"><\/script><script type=\"text\/javascript\"> hbspt.cta.load(2725694, '9d590242-d641-4383-94b4-8cfd62f0af6b', {}); <\/script><\/span><!-- end HubSpot Call-to-Action Code --><\/p>\n\n\n<div class=\"wp-block-media-text alignwide has-media-on-the-right is-stacked-on-mobile is-vertically-aligned-center has-white-background-color has-background\"><div class=\"wp-block-media-text__content\">\n<p class=\"has-large-font-size wp-block-paragraph\">Facing issues? <\/p>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">Our technical support<br>engineers can solve it. <\/p>\n\n\n\n<!--HubSpot Call-to-Action Code --><span class=\"hs-cta-wrapper\" id=\"hs-cta-wrapper-3350a795-db50-482f-9911-301930d1b1be\"><span class=\"hs-cta-node hs-cta-3350a795-db50-482f-9911-301930d1b1be\" id=\"hs-cta-3350a795-db50-482f-9911-301930d1b1be\"><!--[if lte IE 8]><div id=\"hs-cta-ie-element\"><\/div><![endif]--><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/3350a795-db50-482f-9911-301930d1b1be\" ><img decoding=\"async\" class=\"hs-cta-img\" id=\"hs-cta-img-3350a795-db50-482f-9911-301930d1b1be\" style=\"border-width:0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/3350a795-db50-482f-9911-301930d1b1be.png\"  alt=\"Contact Us today!\"\/><\/a><\/span><script charset=\"utf-8\" src=\"https:\/\/js.hscta.net\/cta\/current.js\"><\/script><script type=\"text\/javascript\"> hbspt.cta.load(2725694, '3350a795-db50-482f-9911-301930d1b1be', {\"useNewLoader\":\"true\",\"region\":\"na1\"}); <\/script><\/span><!-- end HubSpot Call-to-Action Code -->\n<\/div><figure class=\"wp-block-media-text__media\"><img fetchpriority=\"high\" decoding=\"async\" width=\"904\" height=\"931\" src=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png\" alt=\"guy server checkup\" class=\"wp-image-12943 size-full\" srcset=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png 904w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-291x300.png 291w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-768x791.png 768w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-585x602.png 585w\" sizes=\"(max-width: 904px) 100vw, 904px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A text editor like vi or vim can be used to comment multiple lines in a shell script (or any other script or configuration file) in a single go rather&hellip;<\/p>\n","protected":false},"author":4,"featured_media":17618,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-602","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-miscellaneous"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO Pro 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"A text editor like vi or vim can be used to comment multiple lines in a shell script. Open the file to be edited using vi\/vim using the command vi filename.\" \/>\n\t<meta name=\"robots\" content=\"max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n\t<meta name=\"author\" content=\"SupportPRO Admin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO Pro (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Server Management Tips | SupportPRO Blog\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"How to Comment Multiple Lines in a Shell Script Using VI\/Vim\" \/>\n\t\t<meta property=\"og:description\" content=\"A text editor like vi or vim can be used to comment multiple lines in a shell script. Open the file to be edited using vi\/vim using the command vi filename.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2012\/03\/How-to-Comment-Multiple-Lines-in-VIVim-in-a-Single-Step.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2012\/03\/How-to-Comment-Multiple-Lines-in-VIVim-in-a-Single-Step.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t\t<meta property=\"og:image:height\" content=\"960\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2012-03-25T08:03:30+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-06-22T08:53:55+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"How to Comment Multiple Lines in a Shell Script Using VI\/Vim\" \/>\n\t\t<meta name=\"twitter:description\" content=\"A text editor like vi or vim can be used to comment multiple lines in a shell script. Open the file to be edited using vi\/vim using the command vi filename.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2012\/03\/How-to-Comment-Multiple-Lines-in-VIVim-in-a-Single-Step.jpg\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\\\/#article\",\"name\":\"How to Comment Multiple Lines in a Shell Script Using VI\\\/Vim\",\"headline\":\"How to Comment Multiple Lines in VI\\\/Vim in a Single Step\",\"author\":{\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/author\\\/managementadmin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/03\\\/How-to-Comment-Multiple-Lines-in-VIVim-in-a-Single-Step.jpg\",\"width\":1920,\"height\":960,\"caption\":\"How to Comment Multiple Lines in VI\\\/Vim in a Single Step\"},\"datePublished\":\"2012-03-25T02:03:30-06:00\",\"dateModified\":\"2026-06-22T02:53:55-06:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\\\/#webpage\"},\"articleSection\":\"Miscellaneous\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.supportpro.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/category\\\/miscellaneous\\\/#listItem\",\"name\":\"Miscellaneous\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/category\\\/miscellaneous\\\/#listItem\",\"position\":2,\"name\":\"Miscellaneous\",\"item\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/category\\\/miscellaneous\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\\\/#listItem\",\"name\":\"How to Comment Multiple Lines in VI\\\/Vim in a Single Step\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\\\/#listItem\",\"position\":3,\"name\":\"How to Comment Multiple Lines in VI\\\/Vim in a Single Step\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/category\\\/miscellaneous\\\/#listItem\",\"name\":\"Miscellaneous\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/#organization\",\"name\":\"SupportPRO\",\"description\":\"SupportPRO Blog\",\"url\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/\",\"telephone\":\"+18476076123\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/author\\\/managementadmin\\\/#author\",\"url\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/author\\\/managementadmin\\\/\",\"name\":\"SupportPRO Admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/13d2f63048d631e03a432375448be5eb7861069df4fef10f0cb1c7b36554c225?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"SupportPRO Admin\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\\\/#webpage\",\"url\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\\\/\",\"name\":\"How to Comment Multiple Lines in a Shell Script Using VI\\\/Vim\",\"description\":\"A text editor like vi or vim can be used to comment multiple lines in a shell script. Open the file to be edited using vi\\\/vim using the command vi filename.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/author\\\/managementadmin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/author\\\/managementadmin\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/03\\\/How-to-Comment-Multiple-Lines-in-VIVim-in-a-Single-Step.jpg\",\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\\\/#mainImage\",\"width\":1920,\"height\":960,\"caption\":\"How to Comment Multiple Lines in VI\\\/Vim in a Single Step\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\\\/#mainImage\"},\"datePublished\":\"2012-03-25T02:03:30-06:00\",\"dateModified\":\"2026-06-22T02:53:55-06:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/\",\"name\":\"Server Management Tips\",\"description\":\"SupportPRO Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.supportpro.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO Pro -->\r\n\t\t<title>How to Comment Multiple Lines in a Shell Script Using VI\/Vim<\/title>\n\n","aioseo_head_json":{"title":"How to Comment Multiple Lines in a Shell Script Using VI\/Vim","description":"A text editor like vi or vim can be used to comment multiple lines in a shell script. Open the file to be edited using vi\/vim using the command vi filename.","canonical_url":"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/","robots":"max-snippet:-1, max-image-preview:large, max-video-preview:-1","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/#article","name":"How to Comment Multiple Lines in a Shell Script Using VI\/Vim","headline":"How to Comment Multiple Lines in VI\/Vim in a Single Step","author":{"@id":"https:\/\/www.supportpro.com\/blog\/author\/managementadmin\/#author"},"publisher":{"@id":"https:\/\/www.supportpro.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2012\/03\/How-to-Comment-Multiple-Lines-in-VIVim-in-a-Single-Step.jpg","width":1920,"height":960,"caption":"How to Comment Multiple Lines in VI\/Vim in a Single Step"},"datePublished":"2012-03-25T02:03:30-06:00","dateModified":"2026-06-22T02:53:55-06:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/#webpage"},"isPartOf":{"@id":"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/#webpage"},"articleSection":"Miscellaneous"},{"@type":"BreadcrumbList","@id":"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.supportpro.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.supportpro.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.supportpro.com\/blog\/category\/miscellaneous\/#listItem","name":"Miscellaneous"}},{"@type":"ListItem","@id":"https:\/\/www.supportpro.com\/blog\/category\/miscellaneous\/#listItem","position":2,"name":"Miscellaneous","item":"https:\/\/www.supportpro.com\/blog\/category\/miscellaneous\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/#listItem","name":"How to Comment Multiple Lines in VI\/Vim in a Single Step"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.supportpro.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/#listItem","position":3,"name":"How to Comment Multiple Lines in VI\/Vim in a Single Step","previousItem":{"@type":"ListItem","@id":"https:\/\/www.supportpro.com\/blog\/category\/miscellaneous\/#listItem","name":"Miscellaneous"}}]},{"@type":"Organization","@id":"https:\/\/www.supportpro.com\/blog\/#organization","name":"SupportPRO","description":"SupportPRO Blog","url":"https:\/\/www.supportpro.com\/blog\/","telephone":"+18476076123"},{"@type":"Person","@id":"https:\/\/www.supportpro.com\/blog\/author\/managementadmin\/#author","url":"https:\/\/www.supportpro.com\/blog\/author\/managementadmin\/","name":"SupportPRO Admin","image":{"@type":"ImageObject","@id":"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/13d2f63048d631e03a432375448be5eb7861069df4fef10f0cb1c7b36554c225?s=96&d=mm&r=g","width":96,"height":96,"caption":"SupportPRO Admin"}},{"@type":"WebPage","@id":"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/#webpage","url":"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/","name":"How to Comment Multiple Lines in a Shell Script Using VI\/Vim","description":"A text editor like vi or vim can be used to comment multiple lines in a shell script. Open the file to be edited using vi\/vim using the command vi filename.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.supportpro.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/#breadcrumblist"},"author":{"@id":"https:\/\/www.supportpro.com\/blog\/author\/managementadmin\/#author"},"creator":{"@id":"https:\/\/www.supportpro.com\/blog\/author\/managementadmin\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2012\/03\/How-to-Comment-Multiple-Lines-in-VIVim-in-a-Single-Step.jpg","@id":"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/#mainImage","width":1920,"height":960,"caption":"How to Comment Multiple Lines in VI\/Vim in a Single Step"},"primaryImageOfPage":{"@id":"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/#mainImage"},"datePublished":"2012-03-25T02:03:30-06:00","dateModified":"2026-06-22T02:53:55-06:00"},{"@type":"WebSite","@id":"https:\/\/www.supportpro.com\/blog\/#website","url":"https:\/\/www.supportpro.com\/blog\/","name":"Server Management Tips","description":"SupportPRO Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.supportpro.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Server Management Tips | SupportPRO Blog","og:type":"article","og:title":"How to Comment Multiple Lines in a Shell Script Using VI\/Vim","og:description":"A text editor like vi or vim can be used to comment multiple lines in a shell script. Open the file to be edited using vi\/vim using the command vi filename.","og:url":"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/","og:image":"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2012\/03\/How-to-Comment-Multiple-Lines-in-VIVim-in-a-Single-Step.jpg","og:image:secure_url":"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2012\/03\/How-to-Comment-Multiple-Lines-in-VIVim-in-a-Single-Step.jpg","og:image:width":1920,"og:image:height":960,"article:published_time":"2012-03-25T08:03:30+00:00","article:modified_time":"2026-06-22T08:53:55+00:00","twitter:card":"summary","twitter:title":"How to Comment Multiple Lines in a Shell Script Using VI\/Vim","twitter:description":"A text editor like vi or vim can be used to comment multiple lines in a shell script. Open the file to be edited using vi\/vim using the command vi filename.","twitter:image":"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2012\/03\/How-to-Comment-Multiple-Lines-in-VIVim-in-a-Single-Step.jpg"},"aioseo_meta_data":{"post_id":"602","title":"How to Comment Multiple Lines in a Shell Script Using VI\/Vim","description":"A text editor like vi or vim can be used to comment multiple lines in a shell script. Open the file to be edited using vi\/vim using the command vi filename.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"seo_analyzer_scan_date":"2026-06-22 08:54:09","breadcrumb_settings":null,"limit_modified_date":false,"open_ai":null,"ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":[],"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"created":"2021-12-10 16:18:04","updated":"2026-06-30 23:31:11","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t<a href=\"https:\/\/www.supportpro.com\/blog\" title=\"Home\">Home<\/a>\n<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t<a href=\"https:\/\/www.supportpro.com\/blog\/category\/miscellaneous\/\" title=\"Miscellaneous\">Miscellaneous<\/a>\n<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\tHow to Comment Multiple Lines in VI\/Vim in a Single Step\n<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.supportpro.com\/blog"},{"label":"Miscellaneous","link":"https:\/\/www.supportpro.com\/blog\/category\/miscellaneous\/"},{"label":"How to Comment Multiple Lines in VI\/Vim in a Single Step","link":"https:\/\/www.supportpro.com\/blog\/commenting-multiple-lines-in-a-shell-script-using-vivim-in-a-single-step\/"}],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/602","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=602"}],"version-history":[{"count":13,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/602\/revisions"}],"predecessor-version":[{"id":17619,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/602\/revisions\/17619"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media\/17618"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=602"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=602"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=602"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}