Fun with Cowsay: How to Install and Use This Quirky Linux Tool

If you've spent any time on the Linux terminal, you may have come across a curious ASCII cow saying something witty. That’s cowsay—a classic command-line utility that brings a bit of fun to your terminal by turning text into speech bubbles delivered by a cartoon cow (or other characters).

What is Cowsay?

cowsay
cowsay preview

Cowsay is a configurable talking cow (written in Perl) that outputs text as if it's spoken by an ASCII-art cow. You can also choose other "cowfiles" (characters) such as Tux the penguin, ghosts, and more. It’s commonly used just for laughs, but also appears in scripts, IRC bots, or fortune pipelines.

How to Install Cowsay

Debian/Ubuntu and derivatives:

sudo apt install cowsay

Arch/Manjaro:

sudo pacman -S cowsay

Fedora:

sudo dnf install cowsay

openSUSE:

sudo zypper install cowsay

macOS (via Homebrew):

brew install cowsay

How to Use Cowsay

Once installed, using cowsay is as simple as typing:

cowsay Hello, Linux world!

This will output an ASCII cow saying "Hello, Linux world!".

Using it with other commands:

fortune | cowsay

This combo displays a random quote or joke inside cowsay's bubble (you need to install fortune separately).

Choose a different character:

cowsay -f tux "I love Linux!"

To list available characters (cowfiles):

cowsay -l

Installing Extra Cowfiles

Cowsay includes a few characters by default, but you can download more cowfiles or create your own. Cowfiles are stored in:

  • /usr/share/cowsay/cows/ (system-wide)
  • ~/.cowsay/ (user-specific)

Simply place the .cow files in the appropriate folder and use them with -f.

How to Remove Cowsay

To uninstall cowsay, use the same package manager:

Debian/Ubuntu:

sudo apt remove cowsay

Arch Linux:

sudo pacman -R cowsay

Where to Use Cowsay

Cowsay is especially fun when integrated into your terminal startup (e.g., in ~/.bashrc or ~/.zshrc), shell scripts, or even inside chat bots. It adds a bit of unexpected personality to an otherwise plain terminal experience.

Additional Options and Fun Parameters

The cowsay command supports several options to change the cow’s mood and appearance. Here’s a handy reference table:

Option Effect
-b Borg mode (eyes become ==)
-d Dead (eyes XX, tongue U)
-g Greedy (eyes $$)
-p Paranoid (eyes @@)
-s Stoned (eyes **, tongue U)
-t Tired (eyes --)
-w Wired (eyes 00)
-y Youthful (eyes ..)
-e [string] Set custom eyes, e.g. -e ^^
-T [string] Set custom tongue, e.g. -T U
-n Disable word wrapping
-W [number] Set balloon width (default is 40)
-f [cowfile] Use alternate character (e.g. -f tux)
-l List available cowfiles

Tips: Colorful Cowsay Output

Want to make your terminal output more vibrant? Combine cowsay with colorizing tools like lolcat or use ANSI escape codes for custom effects.

1. Using lolcat for Rainbow Output

Install lolcat from your package manager, then pipe cowsay into it:

cowsay "Typical cowsay output" | lolcat

Or combine with fortune for a colorful daily quote:

fortune | cowsay -f tux | lolcat


2. Manually Coloring with ANSI Codes

For simple coloring without lolcat, you can wrap the output using ANSI escape codes. Here's how to make your cow red:

echo -e "\e[1;31m$(cowsay 'Warning!')\e[0m"


Replace 1;31m with other color codes:

  • \e[1;32m — Green
  • \e[1;33m — Yellow
  • \e[1;34m — Blue
  • \e[1;35m — Magenta

Use \e[0m at the end to reset the color.

Conclusion

Cowsay may not be essential software, but it’s one of those delightful touches that make using Linux fun. Whether you want to lighten the mood during long sessions or amuse your friends with custom messages, cowsay is always ready to say "moo".

Discover more terminal toys: Paleofetch, Neofetch

Post a Comment

0 Comments