{"id":85,"date":"2025-01-08T13:17:40","date_gmt":"2025-01-08T13:17:40","guid":{"rendered":"https:\/\/blog.sagarra.net\/?p=85"},"modified":"2025-01-08T13:23:28","modified_gmt":"2025-01-08T13:23:28","slug":"vi","status":"publish","type":"post","link":"https:\/\/blog.sagarra.net\/?p=85","title":{"rendered":"VI"},"content":{"rendered":"\n<p>Der m\u00e4chtige Linux Editor \ud83d\ude42 Wie komme ich endlich vom nano weg ?<\/p>\n\n\n\n<p>Hier eine gute Referenz: <a href=\"https:\/\/www.geeksforgeeks.org\/vi-editor-unix\/\">https:\/\/www.geeksforgeeks.org\/vi-editor-unix\/<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Basics<\/h2>\n\n\n\n<p>Der VI hat drei Modi: (fast h\u00e4tte ich Modusse geschrieben \ud83d\ude42<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>Command Mode<\/td><td>[ESC]<\/td><td>l\u00f6schen oder kopieren vom Text<\/td><\/tr><tr><td>Insert Mode<\/td><td>[INS]<\/td><td>Text hinzuf\u00fcgen<\/td><\/tr><tr><td>Escape Mode<\/td><td>[:]<\/td><td>Kommandos ausf\u00fchren, speichern, etc<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Und hier meine wichtigsten commands:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"save-and-exit-in-vi-editor-in-linux\"><strong>Save and Exit in Vi Editor in Linux:<\/strong><\/h2>\n\n\n\n<p>Need to press&nbsp;<strong>[Esc]<\/strong>&nbsp;key followed by the colon (:) before typing the following commands:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Commands&nbsp;<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><th>q<\/th><td>Quit<\/td><\/tr><tr><th>q!<\/th><td>Quit without saving changes i.e. discard changes.<\/td><\/tr><tr><th>r [file_name]<\/th><td>Read data from file called [file_name]<\/td><\/tr><tr><th>wq<\/th><td>Write and quit (save and exit).<\/td><\/tr><tr><th>w<\/th><td>Write to file called [file_name] (save as).<\/td><\/tr><tr><th>w!<\/th><td>Overwrite to file called [file_name] (save as forcefully).<\/td><\/tr><tr><th>!cmd<\/th><td>Runs shell commands and returns to Command mode.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"searching-and-replacing-in-exmode-in-vi-editor-linux\"><strong>Searching and replacing in (ex-Mode) in Vi Editor (Linux):<\/strong><\/h2>\n\n\n\n<p>suchen<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>:s\/string <\/strong><\/pre>\n\n\n\n<p>ersetzen:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">:s\/hello\/hi\/ <\/pre>\n\n\n\n<p>alle ersetzen<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">:%s\/hi\/hello\/ <\/pre>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/suchstring<\/pre>\n\n\n\n<p>mit <strong>n<\/strong> springe zum n\u00e4chsten<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Kopieren, Einf\u00fcgen &amp; L\u00f6schen<\/h2>\n\n\n\n<p>Kopieren, 9yy kopiert 9 Linien<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">yy<\/pre>\n\n\n\n<p>einf\u00fcgen<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">p<\/pre>\n\n\n\n<p>l\u00f6schen &#8211; 1d &#8211;> Linie 1 l\u00f6schen oder 10,$d l\u00f6scht ab linie 10 bis zum Ende<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">dd<br>1d<br>10,$d<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Weiteres<\/h2>\n\n\n\n<p>\u00d6ffne eine Shell aus vi. Aber vorsicht, wenn du die datei mit sudo Rechten ge\u00f6ffnet hast, kommst du als root in die Shell.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>:shell<\/code><\/pre>\n\n\n\n<p>um zu beenden:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>exit<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Der m\u00e4chtige Linux Editor \ud83d\ude42 Wie komme ich endlich vom nano weg ? Hier eine gute Referenz: https:\/\/www.geeksforgeeks.org\/vi-editor-unix\/ Basics Der VI hat drei Modi: (fast h\u00e4tte ich Modusse geschrieben \ud83d\ude42 Command Mode [ESC] l\u00f6schen oder kopieren vom Text Insert Mode [INS] Text hinzuf\u00fcgen Escape Mode [:] Kommandos ausf\u00fchren, speichern, etc Und hier meine wichtigsten commands: &#8230; <a title=\"VI\" class=\"read-more\" href=\"https:\/\/blog.sagarra.net\/?p=85\" aria-label=\"Mehr Informationen \u00fcber VI\">Weiterlesen<\/a><\/p>\n","protected":false},"author":1,"featured_media":89,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[7,4],"tags":[13,27],"class_list":["post-85","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hack","category-linux","tag-linux","tag-vi"],"_links":{"self":[{"href":"https:\/\/blog.sagarra.net\/index.php?rest_route=\/wp\/v2\/posts\/85","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.sagarra.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.sagarra.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.sagarra.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.sagarra.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=85"}],"version-history":[{"count":2,"href":"https:\/\/blog.sagarra.net\/index.php?rest_route=\/wp\/v2\/posts\/85\/revisions"}],"predecessor-version":[{"id":88,"href":"https:\/\/blog.sagarra.net\/index.php?rest_route=\/wp\/v2\/posts\/85\/revisions\/88"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.sagarra.net\/index.php?rest_route=\/wp\/v2\/media\/89"}],"wp:attachment":[{"href":"https:\/\/blog.sagarra.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=85"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.sagarra.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=85"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.sagarra.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}