{"id":271,"date":"2021-06-23T09:20:20","date_gmt":"2021-06-23T09:20:20","guid":{"rendered":"https:\/\/ownwebservers.com\/kb\/?p=271"},"modified":"2021-06-23T09:20:20","modified_gmt":"2021-06-23T09:20:20","slug":"commands-for-vi-editor","status":"publish","type":"post","link":"https:\/\/ownwebservers.com\/kb\/commands-for-vi-editor\/","title":{"rendered":"Commands for VI editor"},"content":{"rendered":"<p>The vi editor comes with every version of\u00a0<a href=\"https:\/\/ownwebservers.com\/web-hosting\/\" target=\"_blank\" rel=\"noopener\">Linux\u00a0<\/a>or Unix.<\/p>\n<p><strong>To Get In and Out Of vi :-<\/strong><\/p>\n<p><strong>To start \u2013<\/strong><\/p>\n<p>vi filename (edit filename starting at line 1)<br \/>\nvi -r filename (recover filename that was being edited when system crashed)<\/p>\n<p><strong>To Exit vi \u2013<\/strong><\/p>\n<p>&lt;Return&gt; (quit vi, writing out modified file to file named in original invocation)<br \/>\n:wq&lt;Return&gt; (quit vi, writing out modified file to file named in original invocation)<br \/>\n:q&lt;Return&gt; (quit or exit vi)<br \/>\n:q!&lt;Return&gt; (quit vi even though latest changes have not been saved for this vi call)<\/p>\n<p><strong>Moving the Cursor :-<\/strong><\/p>\n<p>j or &lt;Return&gt; [or down-arrow] (move cursor down one line)<\/p>\n<p>k [or up-arrow]\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (move cursor up one line)<\/p>\n<p>h or &lt;Backspace&gt; or left-arrow]\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (move cursor left one character)<\/p>\n<p>l or &lt;Space&gt; [or right-arrow] (move cursor right one character)<\/p>\n<p>0 (zero) (move cursor to start of current line, the one with the cursor)<\/p>\n<p>$ (move cursor to end of current line)<\/p>\n<p>w (move cursor to beginning of next word)<\/p>\n<p>b (move cursor back to beginning of preceding word)<\/p>\n<p>:0&lt;Return&gt; or 1G (move cursor to first line in file)<\/p>\n<p>:n&lt;Return&gt; or nG (move cursor to line n)<\/p>\n<p>:$&lt;Return&gt; or G (move cursor to last line in file)<\/p>\n<p><strong>Screen Manipulation :-<\/strong><\/p>\n<p>^f (move forward one screen)<\/p>\n<p>^b (move backward one screen)<\/p>\n<p>^d (move down (forward) one half screen)<\/p>\n<p>^u (move up (back) one half screen)<\/p>\n<p>^l (redraws the screen)<\/p>\n<p>^r (redraws the screen, removing deleted lines)<\/p>\n<p><strong>Adding, Changing, and Deleting Text :-<\/strong><\/p>\n<p><strong>Adding Text \u2013<\/strong><\/p>\n<p>i (insert text before cursor, until &lt;Esc&gt; hit)<\/p>\n<p>I (insert text at beginning of current line, until &lt;Esc&gt; hit)<\/p>\n<p>a (append text after cursor, until &lt;Esc&gt; hit)<\/p>\n<p>A (append text to end of current line, until &lt;Esc&gt; hit)<\/p>\n<p>o (open and put text in a new line below current line, until &lt;Esc&gt; hit)<\/p>\n<p><strong>Changing Text \u2013<\/strong><\/p>\n<p>r (replace single character under cursor, no &lt;Esc&gt; needed)<\/p>\n<p>R (replace characters, starting with current cursor position, until &lt;Esc&gt; hit)<\/p>\n<p>cw (change the current word with new text, starting with the character under cursor, until &lt;Esc&gt; hit)<\/p>\n<p>cNw (change N words beginning with character under cursor, until &lt;Esc&gt; hit; e.g., c5w changes 5 words)<\/p>\n<p>C (change (replace) the characters in the current line, until &lt;Esc&gt; hit)<\/p>\n<p>cc (change (replace) the entire current line, stopping when &lt;Esc&gt; is hit)<\/p>\n<p>Ncc or cNc (change (replace) the next N lines, starting with the current line, stopping when &lt;Esc&gt; is hit)<\/p>\n<p><strong>Deleting Text \u2013<\/strong><\/p>\n<p>x (delete single character under cursor)<\/p>\n<p>Nx (delete N characters, starting with character under cursor)<\/p>\n<p>dw (delete the single word beginning with character under cursor)<\/p>\n<p>dNw (delete N words beginning with character under cursor; e.g., d5w deletes 5 words)<\/p>\n<p>D (delete the remainder of the line, starting with current cursor position)<\/p>\n<p>dd (delete entire current line)<\/p>\n<p>Ndd or dNd (delete N lines, beginning with the current line; e.g., 5dd deletes 5 lines)<\/p>\n<p><strong>Cutting and Pasting Text \u2013<\/strong><\/p>\n<p>yy (copy (yank, cut) the current line into the buffer)<\/p>\n<p>Nyy or yNy (copy (yank, cut) the next N lines, including the current line, into the buffer)<\/p>\n<p>p (put (paste) the line(s) in the buffer into the text after the current line)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The vi editor comes with every version of\u00a0Linux\u00a0or Unix. To Get In and Out Of vi :- To start \u2013 vi filename (edit filename starting at line 1) vi -r filename (recover filename that was being edited when system crashed) To Exit vi \u2013 &lt;Return&gt; (quit vi, writing out modified file to file named in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-271","post","type-post","status-publish","format-standard","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Commands for VI editor - OWS KB<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ownwebservers.com\/kb\/commands-for-vi-editor\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Commands for VI editor - OWS KB\" \/>\n<meta property=\"og:description\" content=\"The vi editor comes with every version of\u00a0Linux\u00a0or Unix. To Get In and Out Of vi :- To start \u2013 vi filename (edit filename starting at line 1) vi -r filename (recover filename that was being edited when system crashed) To Exit vi \u2013 &lt;Return&gt; (quit vi, writing out modified file to file named in [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ownwebservers.com\/kb\/commands-for-vi-editor\/\" \/>\n<meta property=\"og:site_name\" content=\"OWS KB\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/OWN-WEB-SERVERS-107052961577434\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-23T09:20:20+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@OwnWebservers\" \/>\n<meta name=\"twitter:site\" content=\"@OwnWebservers\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/commands-for-vi-editor\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/commands-for-vi-editor\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/#\\\/schema\\\/person\\\/4a40fe3fe17a08ddd1d7c113668e75f2\"},\"headline\":\"Commands for VI editor\",\"datePublished\":\"2021-06-23T09:20:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/commands-for-vi-editor\\\/\"},\"wordCount\":569,\"publisher\":{\"@id\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/#organization\"},\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/commands-for-vi-editor\\\/\",\"url\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/commands-for-vi-editor\\\/\",\"name\":\"Commands for VI editor - OWS KB\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/#website\"},\"datePublished\":\"2021-06-23T09:20:20+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/commands-for-vi-editor\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/commands-for-vi-editor\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/commands-for-vi-editor\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Commands for VI editor\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/\",\"name\":\"OWS KB\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/#organization\",\"name\":\"Own Web Servers\",\"url\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/OWS-Logo-with-punchline-front-scaled.png\",\"contentUrl\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/OWS-Logo-with-punchline-front-scaled.png\",\"width\":2560,\"height\":994,\"caption\":\"Own Web Servers\"},\"image\":{\"@id\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/OWN-WEB-SERVERS-107052961577434\",\"https:\\\/\\\/x.com\\\/OwnWebservers\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ownwebservers.com\\\/kb\\\/#\\\/schema\\\/person\\\/4a40fe3fe17a08ddd1d7c113668e75f2\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ba5db5841d48bd7517bb2583e13983e6d2fa56a4099a0b3c61ad2daefc321303?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ba5db5841d48bd7517bb2583e13983e6d2fa56a4099a0b3c61ad2daefc321303?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ba5db5841d48bd7517bb2583e13983e6d2fa56a4099a0b3c61ad2daefc321303?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\\\/\\\/ownwebservers.com\\\/kb\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Commands for VI editor - OWS KB","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ownwebservers.com\/kb\/commands-for-vi-editor\/","og_locale":"en_US","og_type":"article","og_title":"Commands for VI editor - OWS KB","og_description":"The vi editor comes with every version of\u00a0Linux\u00a0or Unix. To Get In and Out Of vi :- To start \u2013 vi filename (edit filename starting at line 1) vi -r filename (recover filename that was being edited when system crashed) To Exit vi \u2013 &lt;Return&gt; (quit vi, writing out modified file to file named in [&hellip;]","og_url":"https:\/\/ownwebservers.com\/kb\/commands-for-vi-editor\/","og_site_name":"OWS KB","article_publisher":"https:\/\/www.facebook.com\/OWN-WEB-SERVERS-107052961577434","article_published_time":"2021-06-23T09:20:20+00:00","author":"admin","twitter_card":"summary_large_image","twitter_creator":"@OwnWebservers","twitter_site":"@OwnWebservers","twitter_misc":{"Written by":"admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ownwebservers.com\/kb\/commands-for-vi-editor\/#article","isPartOf":{"@id":"https:\/\/ownwebservers.com\/kb\/commands-for-vi-editor\/"},"author":{"name":"admin","@id":"https:\/\/ownwebservers.com\/kb\/#\/schema\/person\/4a40fe3fe17a08ddd1d7c113668e75f2"},"headline":"Commands for VI editor","datePublished":"2021-06-23T09:20:20+00:00","mainEntityOfPage":{"@id":"https:\/\/ownwebservers.com\/kb\/commands-for-vi-editor\/"},"wordCount":569,"publisher":{"@id":"https:\/\/ownwebservers.com\/kb\/#organization"},"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/ownwebservers.com\/kb\/commands-for-vi-editor\/","url":"https:\/\/ownwebservers.com\/kb\/commands-for-vi-editor\/","name":"Commands for VI editor - OWS KB","isPartOf":{"@id":"https:\/\/ownwebservers.com\/kb\/#website"},"datePublished":"2021-06-23T09:20:20+00:00","breadcrumb":{"@id":"https:\/\/ownwebservers.com\/kb\/commands-for-vi-editor\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ownwebservers.com\/kb\/commands-for-vi-editor\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/ownwebservers.com\/kb\/commands-for-vi-editor\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ownwebservers.com\/kb\/"},{"@type":"ListItem","position":2,"name":"Commands for VI editor"}]},{"@type":"WebSite","@id":"https:\/\/ownwebservers.com\/kb\/#website","url":"https:\/\/ownwebservers.com\/kb\/","name":"OWS KB","description":"","publisher":{"@id":"https:\/\/ownwebservers.com\/kb\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ownwebservers.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ownwebservers.com\/kb\/#organization","name":"Own Web Servers","url":"https:\/\/ownwebservers.com\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ownwebservers.com\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2026\/07\/OWS-Logo-with-punchline-front-scaled.png","contentUrl":"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2026\/07\/OWS-Logo-with-punchline-front-scaled.png","width":2560,"height":994,"caption":"Own Web Servers"},"image":{"@id":"https:\/\/ownwebservers.com\/kb\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/OWN-WEB-SERVERS-107052961577434","https:\/\/x.com\/OwnWebservers"]},{"@type":"Person","@id":"https:\/\/ownwebservers.com\/kb\/#\/schema\/person\/4a40fe3fe17a08ddd1d7c113668e75f2","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ba5db5841d48bd7517bb2583e13983e6d2fa56a4099a0b3c61ad2daefc321303?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ba5db5841d48bd7517bb2583e13983e6d2fa56a4099a0b3c61ad2daefc321303?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ba5db5841d48bd7517bb2583e13983e6d2fa56a4099a0b3c61ad2daefc321303?s=96&d=mm&r=g","caption":"admin"},"sameAs":["https:\/\/ownwebservers.com\/kb"]}]}},"_links":{"self":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/271","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/comments?post=271"}],"version-history":[{"count":1,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/271\/revisions"}],"predecessor-version":[{"id":272,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/271\/revisions\/272"}],"wp:attachment":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/media?parent=271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/categories?post=271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/tags?post=271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}