Search

cowsay: a configurable talking and thinking cow

October 28th, 2007 edited by Alexey Beshenov

Article submitted by Alexey Beshenov. We are running out of articles! Please help DPOTD and submit good articles about software you like!

Cowsay is a useless but very fun text filter written in Perl. If you send some text into cowsay, you get an ASCII cow saying your text. For example, cowsay Hello, World! prints

 _______________
< Hello, World! >
 ---------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

To get a thinking cow, run cowthink:

$ cowthink Hello, World!
 _______________
( Hello, World! )
 ---------------
        o   ^__^
         o  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Program word-wraps long messages unless the -n switch is used. The -W specifies where the message should be wrapped (default is wrapping at or before the 40th column). Everything left over after command-line switches is treated as the cow’s message. Another way is to send text to cowsay’s standard input. Pipe boring or annoying things to speaking / thinking cow and have fun:

$ uptime | cowthink -d
 _____________________________________
(  19:16:39 up 4 days, 22:50, 1 user, )
( load average: 2.21, 1.74, 1.42      )
 -------------------------------------
        o   ^__^
         o  (xx)\_______
            (__)\       )\/\
             U  ||----w |
                ||     ||

-d is a switch for a dead cow. Other fun switches for cow are

  • -b Borg mode
  • -g greedy mode
  • -p paranoia mode
  • -s stoned mode
  • -t tired mode
  • -w wired mode
  • -y youthful mode

The -e selects the appearance of the cow’s eyes (default is -e oo). The tongue is configurable through -T (default is no tongue).

You can also use other ASCII characters. Cowsay comes with a large set of “cowfiles” (actually, a pieces of Perl code) in /usr/share/cowsay/cows. Invoke cowsay with the -l switch to list them:

apt, beavis.zen, bong, bud-frogs, bunny, cheese, cower, daemon, default, dragon, dragon-and-cow, elephant, elephant-in-snake, eyes, flaming-sheep, ghostbusters, head-in, hellokitty, kiss, kitty, koala, kosh, luke-koala, mech-and-cow, meow, milk, moofasa, moose, mutilated, ren, satanic, sheep, skeleton, small, sodomized, sodomized-sheep, stegosaurus, stimpy, supermilker, surgery, telebears, three-eyes, turkey, turtle, tux, udder, vader, vader-koala, www.

The -f option specifies a particular cowfile (note that -bdgpstwy modes may not work with some characters as well as -T and -e switches):

$ cowsay -f moose Hi!
 _____
< Hi! >
 -----
  \
   \   \_\_    _/_/
    \      \__/
           (oo)\_______
           (__)\       )\/\
               ||----w |
               ||     ||

Cowsay is written by Tony Monroe. The current stable branch is 3.xx, but Cowsay 4 is also available for testing from the official webpage. Cowsay packages can be found in Debian from Oldstable to Unstable and Experimental, and in Ubuntu Dapper, Edgy, Feisty, Gutsy. Of course, the program depends on Perl.

Posted in Debian, Ubuntu |

8 Responses

  1. Manuel Says:

    Jeje. Nice!
    Now I know where the super cow from apt-get comes from =)

  2. mike Says:

    I know it’s great because my wife thinks it’s stupid.

  3. Idea: use it as a signature Says:

    For ascii emails I use it to display the subject as the first line of every email. But could also display the local weather as a signature, etc.

    Who said the plain text should not be funny?

  4. Name Says:

    # for cow in `cowsay -l | grep -v ^Cow`; do cowsay -f “$cow” “$cow”; done

  5. ubuQ Says:

    Wordpress is messing up the quotes. That’s why your command didn’t
    work here at first. Actually you don’t need any in this case:

    for cow in cowsay -l | grep -v ^Cow; do cowsay -f $cow $cow; done

  6. Jam Says:

    I love this applications :D
    Good command to run is:

    fortune | cowsay

    Jam

  7. Cza Says:

    An amazing toy for the super-bored mind.

  8. jim Says:

    how to cow say color text?