Sunday, October 11, 2009

cowsay - A Configurable Speaking/Thinking Cow

cowsay is a silly little command line text filter that displays a cow saying (or thinking) whatever text you feed it.  For example, each time I log into my server via ssh I am greeted by a friendly cow who gives me a random quote.

cowsay has a number of options that change how the text is displayed and the appearance of the cow (dead, greedy, paranoid, etc.).  There is also a library of "cowfiles" - alternate pictures that can be displayed in place of the cow.

Some of the options available:

The -n option turns off word wrap. If it is specified, the given message will not be word wrapped.

The  -W specifies roughly (where the message should be wrapped.  The default is equivalent to -W 40 i.e. wrap words at or before the 40th column.

There  are  several  provided modes which change the appearance of the cow depending on its particular emotional/physical state.
The -b option initiates Borg mode;
       -d causes the cow to appear dead;
       -g invokes greedy mode;
       -p causes a state of paranoia to come over the cow;
       -s makes the cow appear thoroughly stoned;
       -t yields a tired cow;
       -w is somewhat the opposite of -t, and initiates wired mode;
       -y brings on the cow's youthful appearance.
The -f option  specifies  a particular cow picture file (``cowfile'') to use.
The -l option lists all the cowfiles available

Making the cow say what you want is easy: cowsay moo displays a cow saying "moo".  You can also "pipe" the text to be displayed, like this: echo moo | cowsay .  To display a dragon saying the content of a text file called cowtext, enter cat ~/cowtext | cowsay -f dragon

Installing cowsay

If cowsay isn't already installed in your distribution, installing cowsay is a snap.  Almost all distros include cowsay in their repositories, so its a simple matter of installing via your distro's package manager. (apt/Synaptic, yum, pacman, YasT, etc.)

In the event you can't find a cowsay package for your flavor of Linux, you can download the source tarball from and build cowsay from source.

Cowsay Homepage:


  1. yeah but this didn't work yum install cowsay

  2. cowsay IS an available package for Fedora and Red Hat (the primary users of yum) and that should have worked. Were you root when you tried to install?

  3. yum search cowsay

    sudo yum install cowsay.noarch


  4. u can find it in Debian too
    < great! >
    |o_o |
    |:_/ |
    // \ \
    (| | )
    /'\_ _/`\



If you happened across my blog and find some of the information contained here useful, you have a question, comment, suggestion or perhaps (gasp!) a correction? Please, take a minute and leave a comment.