Cowsay
Encyclopedia
cowsay is a program which generates ASCII
ASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...

 pictures of a cow with a message. It can also generate pictures using pre-made images of other animals. There is also a related program called cowthink, with cows with thought bubbles rather than speech bubbles
Speech balloon
Speech balloons are a graphic convention used most commonly in comic books, comic strips and cartoons to allow words to be understood as representing the speech or thoughts of a given character in the comic...

.


_______________________
< Typical cowsay output! >
-----------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||



.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
Software documentation
Software documentation or source code documentation is written text that accompanies computer software. It either explains how it operates or how to use it, and may mean different things to people in different roles....

. It is more or less a joke within hacker culture
Hacker culture
A hacker is a member of the computer programmer subculture originated in the 1960s in the United States academia, in particular around the Massachusetts Institute of Technology 's Tech Model Railroad Club and MIT Artificial Intelligence Laboratory...

, but has been around long enough that its use is rather widespread. In 2007 it was highlighted as a Debian
Debian
Debian is a computer operating system composed of software packages released as free and open source software primarily under the GNU General Public License along with other free software licenses. Debian GNU/Linux, which includes the GNU OS tools and Linux kernel, is a popular and influential...

 package of the day.

Cowsay is written in the Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...

 programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

, and as such is easily adaptable to system tasks in Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

, such as telling users their home directories are full, they have new mail, et cetera. Additionally, it is quite adaptable to the Common Gateway Interface
Common Gateway Interface
The Common Gateway Interface is a standard method for web servers software to delegate the generation of web pages to executable files...

.

Example

The Unix command fortune can also be piped
Pipeline (Unix)
In Unix-like computer operating systems , a pipeline is the original software pipeline: a set of processes chained by their standard streams, so that the output of each process feeds directly as input to the next one. Each connection is implemented by an anonymous pipe...

 into the cowsay command:


baldur@baldur-desktop:~$ 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 exchange the cow with Tux
Tux
Tux is a penguin character and the official mascot of the Linux kernel. Originally created as an entry to a Linux logo competition, Tux is the most commonly used icon for Linux, although different Linux distributions depict Tux in various styles. In video games featuring the character, female...

, the Linux mascot:


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

Parameters

Option Purpose
-n Disables word wrap
Word wrap
In text display, line wrap is the feature of continuing on a new line when a line is full, such that each line fits in the viewable window, allowing text to be read from top to bottom without any horizontal scrolling....

, allowing the cow to speak FIGlet
FIGlet
FIGlet is a computer program that generates text banners, in a variety of typefaces, composed of letters made up of conglomerations of smaller ASCII characters ....

 or to display other embedded ASCII art
ASCII art
ASCII art is a graphic design technique that uses computers for presentation and consists of pictures pieced together from the 95 printable characters defined by the ASCII Standard from 1963 and ASCII compliant character sets with proprietary extended characters...

. Width in columns becomes that of the longest line, ignoring any value of -W
-W Specifies width of the speech balloon
Speech balloon
Speech balloons are a graphic convention used most commonly in comic books, comic strips and cartoons to allow words to be understood as representing the speech or thoughts of a given character in the comic...

 in columns, i.e. characters in a monospace font. Default value is 40.
-b Borg
Borg (Star Trek)
The Borg are a fictional pseudo-race of cybernetic organisms depicted in the Star Trek universe associated with Star Trek.Whereas cybernetics are used by other races in the science fiction world to repair bodily damage and birth defects, the Borg use enforced cybernetic enhancement as a means of...

 mode”, uses in place of oo for the cow′s eyes.
-d “Dead”, uses XX.
-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
Environment variable
Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer.They can be said in some sense to create the operating environment in which a process runs...

COWPATH.
-l Lists the names of available cow-files in the COWPATH directory instead of displaying a quote.

List all forms


On Linux/Unix you can list all the available forms of cowsay beasts using this command:

cowsay -l | grep -v "^Cow" | sed -e "s% %\n%g" | sed -e "s%\(.*\)%cowsay -f \1 Now I am a \1%" | sh | less

External links
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK