{"id":408,"date":"2023-09-02T19:02:08","date_gmt":"2023-09-02T17:02:08","guid":{"rendered":"https:\/\/linux-bibel.at\/?p=408"},"modified":"2023-09-02T19:02:09","modified_gmt":"2023-09-02T17:02:09","slug":"dateien-unter-linux-direkt-aus-less-heraus-bearbeiten","status":"publish","type":"post","link":"https:\/\/linux-bibel.at\/index.php\/2023\/09\/02\/dateien-unter-linux-direkt-aus-less-heraus-bearbeiten\/","title":{"rendered":"Dateien unter Linux direkt aus less heraus bearbeiten"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Die meisten Linux-Nutzer, die schon ein wenig Erfahrung mit dem Terminal haben, kennen den Befehl:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>less<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Er dient dazu, Textdateien aller Art (also etwa .txt, .html., .php, \u2026) am Terminal anzuzeigen &#8211; etwa:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>less .bashrc<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/less-1024x576.jpg\" alt=\"\" class=\"wp-image-409\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/less-1024x576.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/less-300x169.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/less-768x432.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/less-1536x864.jpg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/less.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Man scrollt sich mit den <kbd>Pfeiltasten<\/kbd> (auf \/ ab) zeilenweise durch die Datei, oder mit <kbd>Bild auf \/ Bild ab<\/kbd> seitenweise, mit <kbd>Umschalt+?<\/kbd> beginnt man eine Suche nach beliebigen Text und mit <kbd>q<\/kbd> wird <code>less<\/code> beendet.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Soweit so bekannt. Viele Benutzer wissen jedoch nicht, dass man direkt aus <code>less<\/code> heraus auch die Datei bearbeiten kann. Hierzu dr\u00fcckt man ganz einfach die Taste <kbd>v<\/kbd>, schon wird in den Editor gewechselt:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/less-1-1024x576.jpg\" alt=\"\" class=\"wp-image-410\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/less-1-1024x576.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/less-1-300x169.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/less-1-768x432.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/less-1-1536x864.jpg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/less-1.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Je nach Editor wird dieser wieder geschlossen, um in <code>less<\/code> zur\u00fcck zu kehren &#8211; bei Nano wird etwa mit <kbd>Strg+o<\/kbd> gespeichert und mit <kbd>Eingabe<\/kbd> best\u00e4tigt, mit <kbd>Strg+x<\/kbd> geschlossen.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ist man mit dem vom System vorkonfigurierten Editor nicht zufrieden, passt man diesen selbst an. Hierzu bearbeitet man direkt die Datei &#8222;.bashrc&#8220; &#8211; also die Konfigurationsdatei der Bash (versteckt liegend) in seinem eigenen Home-Verzeichnis und legt eine neue Zeile an, hier etwa um Nano als Standard zu nutzen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export EDITOR=\/bin\/nano<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Wenn gew\u00fcnscht kann man nat\u00fcrlich auch einen grafischen Editor nutzen, etwa Kate:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export EDITOR=\/usr\/bin\/kate<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Haben Sie einen eigenen Nutzer f\u00fcr den Administrator (root &#8211; Sie werden nicht mit dem Befehl &#8222;<code>sudo<\/code>&#8220; auf dem Terminal zum Administrator), m\u00fcssen Sie diese Anpassungen nat\u00fcrlich auch in dessen Home-Verzeichnis &#8222;\/root\/&#8220; vornehmen &#8211; also in der Datei &#8222;\/root\/.bashrc&#8220;.<\/p>\n<div class=\"pld-like-dislike-wrap pld-custom\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir\" data-post-id=\"408\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Hoch.png\" alt=\"Gef\u00e4llt mir\" \/>\r\n            <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">    <\/span>\r\n<\/div><div class=\"pld-dislike-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-dislike-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir nicht\" data-post-id=\"408\" data-trigger-type=\"dislike\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Runter.png\" alt=\"Gef\u00e4llt mir nicht\" \/>\r\n            <\/a>\r\n    <span class=\"pld-dislike-count-wrap pld-count-wrap\"><\/span>\r\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Die meisten Linux-Nutzer, die schon ein wenig Erfahrung mit dem Terminal haben, kennen den Befehl: Er dient dazu, Textdateien aller Art (also etwa .txt, .html., .php, \u2026) am Terminal anzuzeigen &#8211; etwa: Man scrollt sich mit den Pfeiltasten (auf \/ ab) zeilenweise durch die Datei, oder mit Bild auf \/ Bild ab seitenweise, mit Umschalt+? [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":409,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[12,7,6],"class_list":["post-408","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-terminal","tag-kommandozeile","tag-shell","tag-terminal"],"_links":{"self":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/408","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/comments?post=408"}],"version-history":[{"count":1,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/408\/revisions"}],"predecessor-version":[{"id":411,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/408\/revisions\/411"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media\/409"}],"wp:attachment":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media?parent=408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/categories?post=408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/tags?post=408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}