You can install
cowsay in Debian, Ubuntu or Kali Linux or any aptitude/apt-get based distro using the following command:
apt-get install cowsay (or) sudo apt-get install cowsay
Just like fortune,
cowsay is available in all the basic standard repositories, otherwise just add them for your respective Linux version.
Similar to fortune, you can install
cowsay in Redhat, CentOS, Fedora of any yum based Linux distros using the following command:
yum install cowsay (or) sudo yum install cowsay
If you have a different distro, the command is pretty much the same.
cowsay a sentence/word and a cow will repeat that in your terminal.
Exciting! A talking cow … Well I guess I could go and watch a movie now!
List and location of cowsay files
cowsay creatures are located here:
root@kali:~# ls /usr/share/cowsay/cows/ apt.cow ghostbusters.cow sheep.cow beavis.zen.cow gnu.cow skeleton.cow bong.cow head-in.cow snowman.cow bud-frogs.cow hellokitty.cow sodomized-sheep.cow bunny.cow kiss.cow stegosaurus.cow calvin.cow kitty.cow stimpy.cow cheese.cow koala.cow suse.cow cock.cow kosh.cow three-eyes.cow cower.cow luke-koala.cow turkey.cow daemon.cow mech-and-cow.cow turtle.cow default.cow meow.cow tux.cow dragon-and-cow.cow milk.cow unipony.cow dragon.cow moofasa.cow unipony-smaller.cow duck.cow moose.cow vader.cow elephant.cow mutilated.cow vader-koala.cow elephant-in-snake.cow pony.cow www.cow eyes.cow pony-smaller.cow flaming-sheep.cow ren.cow root@kali:~#
Random Fortune and Cowsay in Linux terminal
Now it’s time to put everything together. You have two options.
- You can add random fortune and cowsay for a single user
- You can add random fortune and cowsay for all users.
Option 1. Random fortune and cowsay for single user
To add random
cowsay for a single user, you need to edit
.bashrc file in the users home directory.
Now add the following line at the bottom of the file:
if [ -x /usr/games/cowsay -a -x /usr/games/fortune ]; then fortune | cowsay -f $(ls /usr/share/cowsay/cows/ | shuf -n1) fi
Save and exit. Reopen terminal and you will see a random creature quoting a different phrase/jokes for that user.