| Home | Index |
Cowsay info
cowsay is a program which generates ASCII pictures of a cow with a message.
It can also generate pictures using pre-made images of other animals, such as
Tux the Penguin, the Linux mascot. Since it is written in Perl, it is
adaptable to other systems such as Microsoft Windows. There is also a related
program called cowthink, with cows with thought bubbles rather than speech
bubbles. .cow files for cowsay exist which are able to produce different
variants of "cows", with different kinds of "eyes", and so forth. It is
sometimes used on IRC, desktop screenshots, and in software documentation.
It is more or less a joke within hacker culture, but has been around long
enough that its use is rather widespread. In 2007 it was highlighted as a
Debian package of the day.

Cowsay and Cowthink are written in the Perl programming language, and as such
is easily adaptable to system tasks in Unix, such as telling users their home
directories are full, they have new mail, etc. Additionally, it is quite
adaptable to the Common Gateway Interface.


    1 Example
    2 Parameters
    3 References
    4 External links


The Unix command fortune can also be piped into the cowsay command:

$ fortune | cowsay
/ You have Egyptian flu: you're going to \
\ be a mummy.                            /
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

And using the parameter -f followed by tux, one can replace the cow with Tux,
the Linux mascot:

$ fortune | cowsay -f tux
/ You are only young once, but you can    \
\ stay immature indefinitely.             /
       |o_o |
       |:_/ |
      //   \ \
     (|     | )
    /'\_   _/`\

Option 	Purpose
-n 	Disables word wrap, allowing the cow to speak FIGlet or to display other
    embedded ASCII art. Width in columns becomes that of the longest line,
	ignoring any value of -W.
-W 	Specifies width of the speech balloon in columns, i.e. characters in a 
    monospace font. Default value is 40.
-b 	"Borg mode", uses == in place of oo for the cow's eyes.
-d 	"Dead", uses XX, plus a descending U to represent an extruded tongue.
-g 	"Greedy", uses $$.
-p 	"Paranoid", uses @@.
-s 	"Stoned", uses ** to represent bloodshot eyes, plus a descending U to 
     represent an extruded tongue.
-t 	"Tired", uses --.
-w 	"Wired", uses OO.
-y 	"Youthful", uses .. to represent smaller eyes.
-e  eye_string 	Manually specifies the cow's eye-type, e.g. cowsay -e ^^ 
    (see Eastern-style emoticon).
-T  tongue_string 	Manually specifies the cow's tongue shape, e.g. 
    cowsay -T \(\) for a pair of parentheses.
-f  cowfile 	Specifies a .cow file from which to load alternative ASCII 
    art. Accepts both absolute file-paths and those relative to the 
	environment variable COWPATH.
-l 	Lists the names of available cow-files in the COWPATH directory 
    instead of displaying a quote.


cowsay/cowthink - configurable speaking/thinking cow (and a bit more)

cowsay [-e eye_string] [-f cowfile] [-h] [-l] [-n] [-T tongue_string] 
       [-W column] [-bdgpstwy]
Cowsay generates an ASCII picture of a cow saying something provided by the 
user. If run with no arguments, it accepts standard input, word-wraps the 
message given at about 40 columns, and prints the cow saying the given message
on standard output.

To aid in the use of arbitrary messages with arbitrary whitespace, use the -n
If it is specified, the given message will not be word-wrapped. This is 
possibly useful if you want to make the cow think or speak in figlet. 
If -n is specified, there must not be any command-line arguments left after 
all the switches have been processed.

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.

If any command-line arguments are left over after all switches have been 
processed, they become the cow’s message. The program will not accept standard
input for a message in this case.

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 initiate
wired mode; -y brings on the cow’s youthful appearance.

The user may specify the -e option to select the appearance of the cow’s eyes,
in which case the first two characters of the argument string eye_string will
be used. The default eyes are ’oo’. 
The tongue is similarly configurable through -T and tongue_string; it must be
two characters and does not appear by default. However, it does appear in the
’dead’ and ’stoned’ modes. Any configuration done by -e and -T will be lost if
one of the provided modes is used.

The -f option specifies a particular cow picture file (‘‘cowfile’’) to use. 
If the cowfile spec contains ’/’ then it will be interpreted as a path 
relative to the current directory. Otherwise, cowsay will search the path 
specified in the COWPATH environment variable. To list all cowfiles 
on the current COWPATH, invoke cowsay with the -l switch.

If the program is invoked as cowthink then the cow will think its message 
instead of saying it.

A cowfile is made up of a simple block of perl code, which assigns a picture
of a cow to the variable $the_cow. Should you wish to customize the eyes or 
the tongue of the cow, then the variables $eyes and $tongue may be used. 
The trail leading up to the cow’s message balloon is composed of the 
character(s) in the $thoughts variable. Any backslashes must be reduplicated
to prevent interpolation. 
The name of a cowfile should end with .cow, otherwise it is assumed not to be
a cowfile. Also, at-signs (‘‘@’’) must be backslashed because that is what 
Perl 5 expects.

What older versions? :-)

Version 3.x is fully backward-compatible with 2.x versions. If you’re still 
using a 1.x version, consider upgrading. And tell me where you got the older
versions, since I didn’t exactly put them up for world-wide access.

Oh, just so you know, this manual page documents version 3.02 of cowsay.

The COWPATH environment variable, if present, will be used to search for 
cowfiles. It contains a colon-separated list of directories, much like PATH or
MANPATH. It should always contain the /usr/share/cowsay/cows directory, or at 
least a directory with a file called default.cow in it.

/usr/share/cowsay/cows holds a sample set of cowfiles. If your COWPATH is not
explicitly set, it automatically contains this directory.

If there are any, please notify the author at the address below.

Tony Monroe (tony [AT] nog.net), with suggestions from Shannon Appel 
(appel [AT] CSUA.EDU) and contributions from Anthony Polito 
(aspolito [AT] CSUA.EDU).

perl(1), wall(1), nwrite(1), figlet(6)