{"id":25928,"date":"2025-04-06T01:53:32","date_gmt":"2025-04-06T04:53:32","guid":{"rendered":"https:\/\/mastertrend.info\/?p=25928"},"modified":"2025-05-12T19:32:35","modified_gmt":"2025-05-12T22:32:35","slug":"editor-vi","status":"publish","type":"post","link":"https:\/\/mastertrend.info\/en\/editor-vi\/","title":{"rendered":"Editor Vi: The Linux trick few people know! Discover it! \ud83d\udd25"},"content":{"rendered":"<h2>Vi Editor: Master it in 3 easy, stress-free steps! \ud83d\ude80<\/h2>\n<p>Vi is a powerful text editor that comes included with most Linux systems, even embedded ones. Sometimes, you&#039;ll need to edit a text file on a system that doesn&#039;t have a more user-friendly text editor, so knowing Vi is key. \u270d\ufe0f<!-- No winning ad found for zone: mid intro! --><\/p>\n<p>Unlike Nano, a simpler terminal-based text editor, Vi doesn&#039;t hand you a list of on-screen keyboard shortcuts. It&#039;s a modal text editor, meaning it has both an insert mode and a command mode.<\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":1,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":1,\"nbrPlacementsScanned\":1,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":201} --><!-- No winning ad found for zone: native in content! --><\/p>\n<h2 id=\"getting-started-with-vi\">Getting Started with Vi<\/h2>\n<p>Vi is a terminal application, so you&#039;ll need to launch it from a terminal window. Use the command <strong>I saw \/path\/to\/file<\/strong> to open an existing file with Vi. The command <strong>I saw \/path\/to\/file<\/strong> also <a title=\"Zoom settings to optimize your experience\" href=\"https:\/\/mastertrend.info\/en\/zoom-settings\/\" target=\"_blank\" rel=\"noopener\" data-wpil-monitor-id=\"5221\">works if the file<\/a> doesn&#039;t exist yet; Vi will create a new file and save it to the specified location when you&#039;re done. \ud83d\udcbe<\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":1,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":1,\"nbrPlacementsScanned\":1,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":499} --><\/p>\n<figure><img decoding=\"async\" style=\"height: auto;max-width: 100%\" src=\"https:\/\/mastertrend.info\/wp-content\/uploads\/2024\/11\/Una-guia-para-principiantes-sobre-la-edicion-de-archivos-de.png\" alt=\"Ubuntu terminal with the vi command being used to open a new file.\" width=\"817\" height=\"155\" title=\"\"> <\/figure>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":1,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":1,\"nbrPlacementsScanned\":1,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":739} --><\/p>\n<p>Remember <a title=\"How to change the owner name in Windows 11: Quick guide \ud83d\ude80\" href=\"https:\/\/mastertrend.info\/en\/how-to-change-owner-name-in-windows-11\/\" target=\"_blank\" rel=\"noopener\" data-wpil-monitor-id=\"5220\">use sudo if you want to edit a file<\/a> of the system. So, for example, you would have to write <strong>sudo vi \/etc\/fstab<\/strong> if you want to edit your fstab file.<\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":1,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":1,\"nbrPlacementsScanned\":1,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":880} --><\/p>\n<h2 id=\"command-mode\">Command Mode<\/h2>\n<p>This is what you&#039;ll see when you open a file in vi. It looks like you can only start typing, but that&#039;s not the case. Vi is a modal text editor, and it opens in command mode. Trying to type in this screen will give you unexpected behavior. \u26a0\ufe0f<\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":210} --><\/p>\n<figure><img decoding=\"async\" style=\"height: auto;max-width: 100%\" src=\"https:\/\/mastertrend.info\/wp-content\/uploads\/2024\/11\/1731459302_771_Una-guia-para-principiantes-sobre-la-edicion-de-archivos-de.png\" alt=\"A file opened in the vi text editor in an Ubuntu terminal window.\" width=\"817\" height=\"164\" title=\"\"> <\/figure>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":450} --><\/p>\n<p>While in command mode, you can move the cursor with the arrow keys. Press the key <strong>x<\/strong> to delete the character under the cursor. There are several other commands for deleting; for example, typing <strong>dd<\/strong> (press the d key twice) deletes an entire line of text. \ud83d\uddd1\ufe0f<\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":709} --><\/p>\n<p>You can select, copy, cut, and paste text in command mode. Place the cursor to the left or right of the text you want to select. <a title=\"Discover how to fix your Gmail spam filter today! \ud83d\ude80\" href=\"https:\/\/mastertrend.info\/en\/how-to-fix-the-gmail-spam-filter\/\" target=\"_blank\" rel=\"noopener\" data-wpil-monitor-id=\"5222\">you want to copy and press the key<\/a> <strong>v<\/strong>. Move the cursor to select the text, and then press <strong>and<\/strong> to copy the selected text or <strong>x<\/strong> to cut it. Place the cursor in the desired location and press the key <strong>p<\/strong> to paste the text you copied or cut.<!-- Repeatable debug data: {\"injection\":\"before\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"isEarlyInjection\":false,\"actualCount\":1057} --><!-- Zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"after\",\"adPosition\":3,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":3,\"nbrPlacementsScanned\":2,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"isEarlyInjection\":false,\"actualCount\":0} --><!-- Repeatable debug data: {\"isEarlyInjection\":false,\"currentRuleCount\":900,\"actualCount\":0,\"hasActualCountMetThreshold\":null,\"countRemainingForInjection\":null,\"nextBlockCount\":null,\"hasCountRemainingForInjectionMetThreshold\":null} --><\/p>\n<figure><img decoding=\"async\" style=\"height: auto;max-width: 100%\" src=\"https:\/\/mastertrend.info\/wp-content\/uploads\/2024\/11\/1731459302_907_Una-guia-para-principiantes-sobre-la-edicion-de-archivos-de.png\" alt=\"Selected text at the end of a file opened in the vi text editor.\" width=\"817\" height=\"164\" title=\"\"> <\/figure>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":3,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":3,\"nbrPlacementsScanned\":3,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":240} --><\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":3,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":3,\"nbrPlacementsScanned\":3,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":240} --><\/p>\n<h2 id=\"insert-mode\">Insertion Mode<\/h2>\n<p>Aside from command mode, the other mode you need to know about is insert mode, which allows you to insert text in Vi. Entering insert mode is easy once you know it exists: just press the key <strong>Yo<\/strong> once after you&#039;ve positioned the cursor in command mode. Start typing and Vi will insert the characters you type into the <a title=\"How to fix BSOD DRIVER_POWER_STATE_FAILURE \ud83d\udea8 Quick fix.\" href=\"https:\/\/mastertrend.info\/en\/fix-bsod-driver_power_state_failure\/\" target=\"_blank\" rel=\"noopener\" data-wpil-monitor-id=\"5223\">file instead of trying to interpret them as commands<\/a>. \ud83d\udcdd<\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":3,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":3,\"nbrPlacementsScanned\":3,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":610} --><\/p>\n<figure><img decoding=\"async\" style=\"height: auto;max-width: 100%\" src=\"https:\/\/mastertrend.info\/wp-content\/uploads\/2024\/11\/1731459302_54_Una-guia-para-principiantes-sobre-la-edicion-de-archivos-de.png\" alt=\"Vi text editor with text indicating that text was added by pressing the &quot;i&quot; key first.\" width=\"817\" height=\"165\" title=\"\"> <\/figure>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":3,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":3,\"nbrPlacementsScanned\":3,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":850} --><\/p>\n<p>Once you&#039;re done in insert mode, press the escape key to return to command mode.<!-- Repeatable debug data: {\"injection\":\"before\",\"adPosition\":3,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":3,\"nbrPlacementsScanned\":3,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"isEarlyInjection\":false,\"actualCount\":930} --><!-- Zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"after\",\"adPosition\":4,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":4,\"nbrPlacementsScanned\":3,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"isEarlyInjection\":false,\"actualCount\":0} --><!-- Repeatable debug data: {\"isEarlyInjection\":false,\"currentRuleCount\":900,\"actualCount\":0,\"hasActualCountMetThreshold\":null,\"countRemainingForInjection\":null,\"nextBlockCount\":null,\"hasCountRemainingForInjectionMetThreshold\":null} --><\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":4,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":4,\"nbrPlacementsScanned\":4,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":188} --><\/p>\n<h2 id=\"saving-and-quitting\">Save and Exit<\/h2>\n<p>Puedes guardar y <a class=\"wpil_keyword_link\" href=\"https:\/\/mastertrend.info\/en\/grok-ai-in-x\/\" target=\"_blank\" rel=\"noopener\" title=\"Grok AI on X: Free access and the most fun chatbot! \ud83e\udd16\ud83c\udf89\" data-wpil-keyword-link=\"linked\" data-wpil-monitor-id=\"7110\">salir de vi<\/a> desde el modo comando. Primero, aseg\u00farate de estar en modo comando presionando la tecla Escape. (Al presionar la tecla Escape de nuevo no pasa nada si ya est\u00e1s en modo comando.)<\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":4,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":4,\"nbrPlacementsScanned\":4,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":415} --><\/p>\n<p>Writes <strong>:wq<\/strong> and press Enter to save the file to disk and exit vi. You can also split this command; for example, type <strong>:w<\/strong> and press enter to save the file to disk without exiting, or type <strong>:q<\/strong> to exit vi without saving the file.<\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":4,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":4,\"nbrPlacementsScanned\":4,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":655} --><\/p>\n<figure><img decoding=\"async\" style=\"height: auto;max-width: 100%\" src=\"https:\/\/mastertrend.info\/wp-content\/uploads\/2024\/11\/1731459302_211_Una-guia-para-principiantes-sobre-la-edicion-de-archivos-de.png\" alt=\"Vi text editor with the &quot;wq&quot; command written at the bottom of the window.\" width=\"817\" height=\"577\" title=\"\"> <\/figure>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":4,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":4,\"nbrPlacementsScanned\":4,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":787} --><br \/>\n<!-- Repeatable debug data: {\"isEarlyInjection\":true,\"currentRuleCount\":900,\"actualCount\":787,\"hasActualCountMetThreshold\":true,\"countRemainingForInjection\":113,\"nextBlockCount\":240,\"hasCountRemainingForInjectionMetThreshold\":true,\"nextCount\":1027} --><\/p>\n<p><!-- Repeatable debug data: {\"injection\":\"before\",\"adPosition\":4,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":4,\"nbrPlacementsScanned\":4,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"isEarlyInjection\":true,\"actualCount\":900} --><!-- Zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"after\",\"adPosition\":5,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":5,\"nbrPlacementsScanned\":4,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"isEarlyInjection\":true,\"actualCount\":0} --><\/p>\n<figure><img decoding=\"async\" style=\"height: auto;max-width: 100%\" src=\"https:\/\/mastertrend.info\/wp-content\/uploads\/2024\/11\/1731459302_223_Una-guia-para-principiantes-sobre-la-edicion-de-archivos-de.png\" alt=\"Vi text editor with error stating &quot;Cannot write since last change&quot; at the bottom of the window.\" width=\"817\" height=\"577\" title=\"\"> <\/figure>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":5,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":5,\"nbrPlacementsScanned\":5,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":127} --><\/p>\n<hr \/>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":5,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":5,\"nbrPlacementsScanned\":5,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":127} --><\/p>\n<p>If you&#039;re looking for a more user-friendly terminal text editor, check out Nano. Most Linux distributions come with <a href=\"https:\/\/www.nano-editor.org\/\" target=\"_blank\" rel=\"noopener\" data-schema-attribute=\"mentions\">Elder brother<\/a> preinstalled, but embedded systems and other small environments often only include Vi. \ud83d\udda5\ufe0f<\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":5,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":5,\"nbrPlacementsScanned\":5,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":335} --><\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":5,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":5,\"nbrPlacementsScanned\":5,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":655} --><\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":5,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":5,\"nbrPlacementsScanned\":5,\"ruleCount\":900,\"degradationStartingPoint\":1,\"stopAds\":null,\"actualCount\":712} --><\/p>","protected":false},"excerpt":{"rendered":"<p>Vi Editor is the key to quick and easy text editing in Linux. Master it now and excel in minutes. \ud83d\udcbb\u2728<\/p>","protected":false},"author":1,"featured_media":23416,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ai_generated_summary":"","iawp_total_views":45,"jnews-multi-image_gallery":[],"jnews_single_post":[],"jnews_primary_category":[],"jnews_social_meta":[],"jnews_review":[],"enable_review":"","type":"","name":"","summary":"","brand":"","sku":"","good":[],"bad":[],"score_override":"","override_value":"","rating":[],"price":[],"jnews_override_counter":[],"footnotes":""},"categories":[1435],"tags":[1445,1686,1558],"class_list":["post-25928","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutoriales","tag-evergreencontent","tag-productividad","tag-techtips"],"_links":{"self":[{"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/posts\/25928","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/comments?post=25928"}],"version-history":[{"count":8,"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/posts\/25928\/revisions"}],"predecessor-version":[{"id":104619,"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/posts\/25928\/revisions\/104619"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/media\/23416"}],"wp:attachment":[{"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/media?parent=25928"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/categories?post=25928"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/tags?post=25928"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}