{"id":18219,"date":"2025-03-01T10:05:54","date_gmt":"2025-03-01T09:05:54","guid":{"rendered":"https:\/\/linux-bibel.at\/?p=18219"},"modified":"2025-03-01T10:10:31","modified_gmt":"2025-03-01T09:10:31","slug":"bat-die-bessere-alternative-zu-cat-unter-linux-auf-dem-terminal","status":"publish","type":"post","link":"https:\/\/linux-bibel.at\/index.php\/2025\/03\/01\/bat-die-bessere-alternative-zu-cat-unter-linux-auf-dem-terminal\/","title":{"rendered":"bat &#8211; die bessere Alternative zu cat unter Linux auf dem Terminal"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Will man sich unter Linux auf dem Terminal schnell den Inhalt einer Textdatei anzeigen lassen, nutzt man entweder den Befehl <code>less<\/code> oder <code>cat<\/code> &#8211; beispielsweise:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat .zshrc<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat.jpeg\" rel=\"lightbox-0\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"575\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-1024x575.jpeg\" alt=\"\" class=\"wp-image-18220\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-1024x575.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-150x84.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-300x169.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-768x431.jpeg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat.jpeg 1116w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Oder eben mit <code>less<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>less .zshrc<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-1.jpeg\" rel=\"lightbox-1\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"575\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-1-1024x575.jpeg\" alt=\"\" class=\"wp-image-18221\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-1-1024x575.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-1-150x84.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-1-300x169.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-1-768x431.jpeg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-1.jpeg 1116w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Beide haben ein kleines Problem &#8211; sie kennen keine Syntax-Hervorhebung, der Text sieht wie Einheitsbrei aus.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>bat<\/strong> zeigt nicht nur die Syntax perfekt markiert an, sondern auch die Zeilennummern.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">bat installieren<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Unter auf Debian basierenden Linux-Distributionen installieren Sie diese Software ganz einfach \u00fcber die Paket-Verwaltung, entweder \u00fcber <a href=\"https:\/\/linux-bibel.at\/index.php\/2023\/10\/29\/synaptic-die-ultimative-paket-verwaltung-von-debian\/\" data-type=\"post\" data-id=\"10661\">Synaptic<\/a> oder gleich als root auf dem Terminal:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install bat<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Auch unter Red Hat, Fedora und Alma findet sich das gleichnamige Paket, wie auch unter openSUSE, Gentoo und Arch.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">bat nutzen<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Je nach Linux-Distribution starten Sie auf dem Terminal den Befehl <code>bat<\/code> oder <code>batcat<\/code> (Debian), dazu geben Sie die zu \u00f6ffnende Textdatei an:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bat .zshrc\nbatcat .zshrc<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Oder mit dem Pfad:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bat \/home\/username\/.zshrc\nbatcat \/home\/username\/.zshrc<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-2.jpeg\" rel=\"lightbox-2\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"575\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-2-1024x575.jpeg\" alt=\"\" class=\"wp-image-18223\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-2-1024x575.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-2-150x84.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-2-300x169.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-2-768x431.jpeg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/03\/batcat-2.jpeg 1116w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Beendet wird die Ausgabe mit der Taste <kbd>q<\/kbd>.<\/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=\"18219\" 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\">14    <\/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=\"18219\" 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>Will man sich unter Linux auf dem Terminal schnell den Inhalt einer Textdatei anzeigen lassen, nutzt man entweder den Befehl less oder cat &#8211; beispielsweise: Oder eben mit less: Beide haben ein kleines Problem &#8211; sie kennen keine Syntax-Hervorhebung, der Text sieht wie Einheitsbrei aus. bat zeigt nicht nur die Syntax perfekt markiert an, sondern [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":18223,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,101],"tags":[12,7,6,289],"class_list":["post-18219","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-terminal","category-tipps","tag-kommandozeile","tag-shell","tag-terminal","tag-tipps"],"_links":{"self":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/18219","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=18219"}],"version-history":[{"count":2,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/18219\/revisions"}],"predecessor-version":[{"id":18225,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/18219\/revisions\/18225"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media\/18223"}],"wp:attachment":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media?parent=18219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/categories?post=18219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/tags?post=18219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}