{"id":399,"date":"2026-02-05T03:48:08","date_gmt":"2026-02-05T03:48:08","guid":{"rendered":"https:\/\/mitalgoswami.in\/?p=399"},"modified":"2026-02-17T04:36:56","modified_gmt":"2026-02-17T04:36:56","slug":"vi-editor-visual-editor","status":"publish","type":"post","link":"https:\/\/mitalgoswami.in\/?p=399","title":{"rendered":"vi Editor \u2013 Visual editor"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\"><strong>Introduction<\/strong><\/h3>\n\n\n\n<p>The <strong>vi editor<\/strong> is a <strong>screen-oriented, full-screen text editor<\/strong> used in <strong>UNIX and Linux operating systems<\/strong>. It is one of the oldest and most powerful text editors, designed to work efficiently from the command line. The name <strong>vi<\/strong> comes from <strong>\u201cvisual editor\u201d<\/strong>. Because of its speed, small size, and availability on almost every UNIX\/Linux system, vi is widely used by system administrators, programmers, and students.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Features of vi Editor<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Works completely in <strong>terminal\/command-line<\/strong><\/li>\n\n\n\n<li><strong>No graphical interface<\/strong> required<\/li>\n\n\n\n<li>Very <strong>fast and lightweight<\/strong><\/li>\n\n\n\n<li>Supports <strong>keyboard-based editing<\/strong><\/li>\n\n\n\n<li>Available by default on almost all UNIX\/Linux systems<\/li>\n\n\n\n<li>Can edit very <strong>large files efficiently<\/strong><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Working Principle of vi<\/strong><\/h2>\n\n\n\n<p>The vi editor works using <strong>different modes<\/strong>. Each mode has a specific purpose. This mode-based working style makes vi very powerful but slightly difficult for beginners.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Modes of vi Editor<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. Command Mode (Normal Mode)<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This is the <strong>default mode<\/strong> when vi starts.<\/li>\n\n\n\n<li>Used for <strong>navigation, deleting, copying, pasting, saving, and quitting<\/strong>.<\/li>\n\n\n\n<li>No text can be typed in this mode.<\/li>\n\n\n\n<li>Press <code>Esc<\/code> anytime to return to command mode.<\/li>\n<\/ul>\n\n\n\n<p><strong>Examples:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dd   \u2192 delete a line\nyy   \u2192 copy a line\np    \u2192 paste copied text\nu    \u2192 undo last change\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. Insert Mode<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Used to <strong>enter or modify text<\/strong>.<\/li>\n\n\n\n<li>You can type characters normally in this mode.<\/li>\n\n\n\n<li>Enter Insert Mode using:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>i  \u2192 insert before cursor\na  \u2192 insert after cursor\no  \u2192 open a new line below\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Exit Insert Mode by pressing <code>Esc<\/code>.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Last Line Mode (Ex Mode)<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Used for <strong>saving files, quitting, searching, and replacing text<\/strong>.<\/li>\n\n\n\n<li>Enter this mode by typing <code>:<\/code> in command mode.<\/li>\n<\/ul>\n\n\n\n<p><strong>Common commands:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>:w      \u2192 save file\n:q      \u2192 quit\n:wq     \u2192 save and quit\n:q!     \u2192 quit without saving\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Starting vi Editor<\/strong><\/h2>\n\n\n\n<p>To open a file in vi:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vi filename\n<\/code><\/pre>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vi notes.txt\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If the file does not exist, vi will create it.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Cursor Movement Commands<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>h \u2192 move left\nl \u2192 move right\nk \u2192 move up\nj \u2192 move down\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Text Editing Commands<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>x    \u2192 delete a character\ndd   \u2192 delete a line\nD    \u2192 delete from cursor to end of line\nr    \u2192 replace a character\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Copy and Paste Commands<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>yy   \u2192 copy a line\nyw   \u2192 copy a word\np    \u2192 paste after cursor\nP    \u2192 paste before cursor\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Search and Replace<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\/word        \u2192 search forward\n?word        \u2192 search backward\nn            \u2192 next occurrence\n:%s\/old\/new\/g \u2192 replace all occurrences\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Advantages of vi Editor<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Available on almost every system<\/li>\n\n\n\n<li>Extremely <strong>fast and efficient<\/strong><\/li>\n\n\n\n<li>Requires <strong>very less memory<\/strong><\/li>\n\n\n\n<li>Ideal for <strong>remote servers<\/strong><\/li>\n\n\n\n<li>Powerful editing commands<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Disadvantages of vi Editor<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Difficult for beginners<\/li>\n\n\n\n<li>No mouse support<\/li>\n\n\n\n<li>Commands must be memorized<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Uses of vi Editor<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Editing configuration files<\/li>\n\n\n\n<li>Writing shell scripts<\/li>\n\n\n\n<li>Programming in C, Python, etc.<\/li>\n\n\n\n<li>System administration tasks<\/li>\n\n\n\n<li>Editing files on remote servers<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction The vi editor is a screen-oriented, full-screen text editor used in UNIX and Linux operating systems. It is one of the oldest and most powerful text editors, designed to work efficiently from the command line. The name vi comes from \u201cvisual editor\u201d. Because of its speed, small size, and availability on almost every UNIX\/Linux [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-399","post","type-post","status-publish","format-standard","hentry","category-unix"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/posts\/399","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=399"}],"version-history":[{"count":1,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/posts\/399\/revisions"}],"predecessor-version":[{"id":400,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/posts\/399\/revisions\/400"}],"wp:attachment":[{"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=399"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}