LinuxCommandLibrary

cowsay

Display customizable messages with an ASCII cow

TLDR

Print an ASCII cow saying "hello, world"

$ cowsay "[hello, world]"
copy

Print an ASCII cow saying text from stdin
$ echo "[hello, world]" | cowsay
copy

List all available art types
$ cowsay -l
copy

Print the specified ASCII art saying "hello, world"
$ cowsay -f [art] "[hello, world]"
copy

Print a dead thinking ASCII cow
$ cowthink -d "[I'm just a cow, not a great thinker...]"
copy

Print an ASCII cow with custom eyes saying "hello, world"
$ cowsay -e [characters] "[hello, world]"
copy

SYNOPSIS

cowsay [options] message
cowsay [options] -f cowfile message
fortune | cowsay [options]

PARAMETERS

-b
    Borg mode. Produces a cow that looks like a Borg drone.

-d
    Dead mode. Makes the cow's eyes appear 'dead'.

-g
    Greedy mode. Changes the cow's eyes to look greedy.

-s
    Stoned mode. Gives the cow a 'stoned' look with droopy eyes.

-t
    Tired mode. Displays the cow as tired.

-w
    Wired mode. Makes the cow appear hyper.

-y
    Young mode. Displays a young cow.

-e eyes
    Specifies the eye string for the cow. Default is oo. E.g., cowsay -e "==" "Hello".

-f cowfile
    Specifies the animal to use from the available cowfiles. Use -l to list them. E.g., cowsay -f dragon "Fire!".

-h
    Displays a brief help message and exits.

-l
    Lists all available cowfiles in the COWPATH directory.

-n
    Disables automatic word wrapping. The message will be printed as is, potentially exceeding terminal width.

-T tongue
    Specifies the tongue string for the cow. Default is U. E.g., cowsay -T "xX" "OMG!".

-u
    Upside-down mode. Inverts the cow's appearance. Often combined with other mood options for effect.

-W column
    Specifies the column at which the message should be word-wrapped. Default is 40 columns.

DESCRIPTION

cowsay is a whimsical command-line utility that generates ASCII art pictures of a cow (or other specified animals) saying a message. It takes input text, wraps it in a classic speech bubble, and places it above the ASCII art representation of the animal. The primary function is to make terminal output more engaging or humorous. Users can customize various aspects of the output, including the animal itself by choosing from a collection of "cowfiles," altering the animal's eyes and tongue, or changing its mood (e.g., dead, stoned, greedy). Messages can be provided directly as an command-line argument, or piped from other commands, making cowsay a popular tool for adding a quirky touch to shell scripts, login messages, or simple text outputs. It's widely used in the Unix/Linux community for its entertainment value and ease of integration.

CAVEATS

cowsay relies on a collection of ASCII art files (cowfiles) to generate its output. If these files are missing or inaccessible, the command may not function as expected or might only display the default cow. Output can be quite large and might not fit well on very small terminal screens without wrapping issues. While amusing, its use in professional or critical contexts is generally limited to novelty or humor.

COWFILES AND CUSTOMIZATION

Cowfiles are simple text files containing the ASCII art definitions for various animals. These files are typically located in /usr/share/cowsay/cowfiles/ or /usr/local/share/cowsay/cowfiles/. Users can create their own cowfiles to define new characters or modify existing ones. The COWPATH environment variable can be set to specify additional directories where cowsay should look for cowfiles, allowing for personal collections of ASCII art animals.

COMMON USE CASES

Displaying humorous messages:
cowsay "Hello, world!"

Combining with fortune:
fortune | cowsay

Using different animals:
cowsay -f dragon "Beware of dragons!"

Modifying moods and looks:
cowsay -d -e "XX" -T "~" "I'm dead tired."

Adding to login greetings:
Adding fortune | cowsay to your .bashrc or .profile file to display a random message when you log in.

HISTORY

The cowsay program was originally written by Tony Monroe in 1997. It quickly gained popularity among Unix and Linux users due to its simple yet entertaining nature. It's often found pre-installed or easily available in package repositories of most major Linux distributions. Its enduring appeal lies in its ability to add a touch of personality and humor to otherwise plain terminal output, making it a staple in many .bashrc files and shell scripts for generating amusing messages. The concept of "cowfiles" for custom animals has allowed for community contributions and further diversification of its capabilities.

SEE ALSO

fortune(6), figlet(6), toilet(1), banner(6)

Copied to clipboard