Cowsay (or tuxsay) fortunes in terminal

This is a quick guide on how to have Cowsay (or Tuxsay, etc.) with fortunes upon opening the terminal.

I have it set up using fortune's "wisdom" quotes. They're not difficult to create; install the "fortune-mod" package (along with "fortunes" and "cowsay"); use the strfile tool on a formatted text file like "strfile vocab-fortune vocab-fortune.dat" and put it in fortune's directory, e.g. /usr/share/games/fortunes/ on Debians.
I have a kjv & a vocabulary one I made available here.

term-fortune.png

example screenshot

Add the following to your ~/.bashrc (".bashrc" is a hidden file in the Home or "~/" directory):

# BASH COWSAY WITH FORTUNE
alias cowsay='cowsay -f tux'
if [ -x /usr/games/cowsay -a -x /usr/games/fortune ]; then
    fortune -s kjv | cowsay
fi

The alias is for it to use tux and the "fortune -s wisdom" is where to set the fortune file to be used.





Back to Top