Moo! There is a Cow in My Linux Terminal

The cowsay is a fun little Linux command line utility that can be enjoyed in so many ways. Here are several examples.

The Linux terminal can be a fun place if you want it to be.

Of course, it is used for serious work but you have funny Linux commands to amuse yourself.

The cowsay is one such tool. It gives you a cow in the terminal.

Cowsay command in Linux
Yes, that's a cow in case you have difficulty recognizing it ;)

The thing about cowsay is that it could be used for 'serious work' if combined with other commands. One such example is using it to display the 'message of the day' on a shared Linux server with multiple users.

Sounds interesting? Time to ฬถmฬถiฬถlฬถkฬถ install it.

Install Cowsay

Cowsay is a popular tool and it is available in the repositories of most Linux distributions.

To install cowsay in Debian and Ubuntu system, open a terminal and run:

sudo apt install cowsay

For Fedora, use:

sudo dnf install cowsay

And in Arch Linux based distros, use:

sudo pacman -S cowsay

Using Cowsay

As the name suggests, this is an ASCII talking cow, that outputs text provided as its input. By default, cowsay provides several options to tweak the look and appearance of the ASCII cow.

Normal Cowsay

cowsay <Text>

This will print whatever text you provided in a speechbubble with the cow .

The default cowsay command
Cowsay

Or you can provide output of another command, say echo as input to cowsay using pipes redirection.

echo "Hello" | cowsay

Greedy Cow

Here, cow appears to be greedy, with Dollar eyes.

cowsay -g <message>
Cowsay command with greedy option
Greedy Cowsay

Use Special Characters as eyes

You can use the -e option, and then provide two characters that you want to appear as eyes. The default is โ€œOOโ€.

cowsay -e hh <hello>
Cowsay command with custom eye charaters
Special Eyes

Here, in the above screenshots, two โ€œhโ€ will appear in place of eyes.

๐Ÿšง
If the characters entered by you has already been used by any of the default option, say $$, then it is lost.

Use another character instead of the cow

Cowsay provides many other ASCII images also, which you can use through the option -f.

List them with option -l:

cowsay -l
Various default cowsay cow files listed using "ls /usr/share/cowsay/cows/" and "cowsay -l"
Various default cowsay cow files

Now, to print one of the above images, use:

cowsay -f <cowfile name> <message>
Cowsay command using different images instead of the default cow
Different Images

Similarly, in newer versions, you can use -r option to randomly print one of the above images.

cowsay -r Hello

Other options

Option Use
-b Invokes Borg mode
-d Causes the cow to appear dead
-p Causes a state of paranoia to come over the cow
-s Makes the cow appear thoroughly stoned
-t A tired cow
-y Brings on the cowโ€™s youthful appearance

Using Cowthink

Cowthink is an adjoint program that come with cowsay. Instead of the speach bubble, it displays the thought bubble. It will make more sense to you if you are familiar with comic book notations.

cowthink Hello
Default Cowthink command
Cowthink

All the options that were mentioned with cowsay will work here as well.

Using Cowsay with Fortune

With the help of pipe redirection, you can use cowsay along with another popular fun Linux command, the fortune command.

๐Ÿ’ก
Install fortune and lolcat in Ubuntu using sudo apt install fortune lolcat

For those of you, who donโ€™t know what fortune, it is a small program, that prints quotes from famous persons on a terminal. You can run it as a standalone command like:

fortune

To simply print what fortune says using cowsay, run:

fortune | cowsay

You can also add the cowsay options to make it better:

fortune | cowsay -f dragon 

Using a colorful cow with lolcat

Many of you know lolcat and its rainbow effects on texts. So why not use it along with the above programs? All you have to do is to pipe the cowsay command to lolcat.

cowsay Hello | lolcat
Running cowsay and lolcat
Cowsay Lolcat

Now, if you want to add fortune and various cowsay options along with this, use all such options and pipe the entire thing to lolcat, like this:

fortune | cowsay -f tux | lolcat
fortune | cowthink -f tux | lolcat
Running fortune, cowsay and lolcat together
Cowsay, Tux, Fortune and Lolcat

Third-party cow files (for advanced users)

Not interested in the default cowsay cow files? Do not worry, there are a huge number of different cowfiles out there, created by enthusiast developers. Two of them, I will mention here. https://github.com/bkendzior/cowfiles and https://github.com/paulkaefer/cowsay-files

You can either install the cowfiles from these repositories as mentioned on their README, or just download the required cowfile (.cow) from the repository and paste them on /usr/share/cowsay/site-cows/. Now, you can access that cowfile using its name:

cowsay -f <new file name> Hello

You can see in the screenshot I have used a downloaded cow file, called C3PO.cow.

For those of you, who want to create your own images, you can visit Charc0alโ€™s cowsay file.

Third Party cowfiles
Third Party Cowfiles

Here, you can either download the existing files, or convert some of your images (recommend no larger than 50 ร— 50) for the purpose.

Other funny uses

Use cowsay prompt to enter password in sudo commands:

sudo -p "$(cowsay 'If you know the password, enter it here. Or just go away:')" <command>
Cowsay Sudo prompt
Cowsay Sudo prompt

Make cowsay as an entry to your bash config, so you are greeted every time you open the terminal.

  • For newer cowsay versions, like those in Fedora, add fortune | cowsay -r | lolcat to your ~/.bashrc. Now, each time, you open the terminal, a new cowfile with a different quote will be printed.
  • For older versions of cowsay, where you cannot get the random (-r) option, you can get different files manually, and use fortune | cowsay -f <name of particular cowfile to use> | lolcat.

Make other commands show output using cowsay

You can make commands like lsblk to print the output using cowsay. Just pipe those commands.

lsblk | cowsay

Use cowsay-beefymiracle in Fedora

beefymiracle is a cowsay package available in Fedora. The cow is turned into beef here (my vegetarian heart cries ๐Ÿ˜ข).

Use the below command to install it:

sudo dnf install cowsay-beefymiracle

Now, run:

cowsay -f beefymiracle <message>
cowsay beefymiracle file
Beef instead of cow but who killed the cow?

Bonus: XCowsay

xcowsay is a graphical alternative to the normal cowsay. Here, the cow is no more ASCII, but a proper image. You can install it by:

sudo apt install xcowsay

Now run:

xcowsay <message>

This will display the graphical cow for a specific amount of time according to the length of the text, and then disappears. You can click on it to hide it immediately, though.

xcowsay command
xcowsay command

What is more interesting is the cow can 'dream' images instead of texts. Or even the cow image can be changed to random images.

Use either:

xcowsay --dream=file

OR

xcowsay --image=file --dream=file

You can explore the man page of xcowsay for more options.

More ASCII fun in the terminal

Love ASCII? How about displaying your distribution's logo in ASCII format with Neoftech?

Display Linux Distribution Logo in ASCII Art in Terminal
Wondering how they display Linux logo in terminal? With these tools, you can display logo of your Linux distribution in ASCII art in the Linux terminal.

Why restrict with logo? Here are more ASCII tools for Linux terminal.

10 Tools to Generate and Have Fun With ASCII Art in Linux Terminal
Linux terminal is not as scary as you think. Of course, it could be intimidating in the beginning but once you know the terminal better, you start loving it. You are likely to use the terminal for serious work. But there are many fun stuff you can do in the

Don't stop the fun in the terminal.

12 Linux Commands to Have Some Fun in the Terminal
So, you think Linux terminal is all work and no fun? These funny Linux commands will prove you wrong. The Linux terminal is the place to get serious work done. We have plenty of useful linux command tips and tricks to help you with that. But, did you know that

I hope you liked this tutorial on using cowsay in various formats. It's amazing that this little tool comes with so many options and there are so many ways to use it.

Which cowsay example did you like the most here? Don't say beef one ๐Ÿ’”

About the author
Sreenath

Sreenath

Linux tinkerer by day, Lord of the Rings fanatic by night. When I'm not busy conquering the command line, you can find me kicking back and watching some football while quoting JRR Tolkien

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

It's FOSS

Great! Youโ€™ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.