{"id":167,"date":"2012-08-16T01:05:28","date_gmt":"2012-08-16T05:05:28","guid":{"rendered":"https:\/\/infotechguy.net\/?p=167"},"modified":"2025-02-22T11:30:07","modified_gmt":"2025-02-22T16:30:07","slug":"showing-cowsay-and-fortune-in-every-terminal","status":"publish","type":"post","link":"https:\/\/infotechguy.net\/?p=167","title":{"rendered":"Linux &#8212; ASCII Art in Terminal Sessions"},"content":{"rendered":"<p>I was wondering today&#8230;I used to see this screenshot of a ASCII cow in a terminal that was giving some sort of advice or fortune. After a little googling I found the application <a href=\"http:\/\/en.wikipedia.org\/wiki\/Fortune_%28Unix%29\" target=\"_blank\" rel=\"noopener noreferrer\">fortune<\/a> which shows you a simple fortune when run from a terminal on linux\/unix. I also found the application cowsay which is the app that shows the <a href=\"http:\/\/en.wikipedia.org\/wiki\/ASCII_art\" target=\"_blank\" rel=\"noopener noreferrer\">ASCII art<\/a> of animals with a <a href=\"http:\/\/en.wikipedia.org\/wiki\/Speech_balloon\" target=\"_blank\" rel=\"noopener noreferrer\">comic balloon<\/a>. By default a cow, however there are many others. I chose tux.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ fortune | cowsay\r\n _______________________________________\r\n\/ Don't go around saying the world owes \r\n| you a living. The world owes you      |\r\n| nothing. It was here first.           |\r\n|                                       |\r\n -- Mark Twain                         \/\r\n ---------------------------------------\r\n           ^__^\r\n           (oo)_______\r\n            (__)       )\/\r\n                ||----w |\r\n                ||     ||\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Why the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Pipeline_%28Unix%29\" target=\"_blank\" rel=\"noopener noreferrer\">pipe<\/a>? because fortune echos a string, and cowsay reads in a string.<\/p>\n<p>Now the problem was I had to type the command every single time. To solve this we turn to your users .bashrc file. Located <strong>~\/.bashrc<\/strong> for Ubuntu users. Edit the file with your favorite text editor and add the following lines at the bottom.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">if [ -x \/usr\/games\/cowsay -a -x \/usr\/games\/fortune ]; \r\nthen fortune | cowsay \r\nfi<\/pre>\n<p>&nbsp;<\/p>\n<p><code><br \/>\n<\/code><\/p>\n<p>(if statement checks to make sure both <strong>cowsay<\/strong> and <strong>fortune<\/strong> are installed)<br \/>\nNow, everytime you open a terminal or command prompt you&#8217;ll have a cool animal telling you a fortune!<\/p>\n<p>Sources:<br \/>\n<a href=\"http:\/\/askubuntu.com\/questions\/16428\/showing-a-cowsays-in-every-new-terminal-session\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/askubuntu.com\/questions\/16428\/showing-a-cowsays-in-every-new-terminal-session<\/a><br \/>\nCool Android app <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=ch.fixme.cowsay\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>. This will send SMS text messages from your phone as cowsay!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was wondering today&#8230;I used to see this screenshot of a ASCII cow in a terminal that was giving some sort of advice or fortune. After a little googling I found the application fortune which&#46;&#46;&#46;<\/p>\n","protected":false},"author":2,"featured_media":4240,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[111],"class_list":["post-167","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-scripting"],"_links":{"self":[{"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/posts\/167","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=167"}],"version-history":[{"count":1,"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/posts\/167\/revisions"}],"predecessor-version":[{"id":4186,"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/posts\/167\/revisions\/4186"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/media\/4240"}],"wp:attachment":[{"href":"https:\/\/infotechguy.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}