Random Cow Fortunes in Terminal :P

Fortune favors the cow (not really). fortune cowsay lolcat output


From a high level this is what you do:

  1. Install cowsay and fortune via HomeBrew for Mac users or apt-get for linux (or whatever package manager you use)
  2. Install lolcat via Rubygems
  3. ???
  4. Profit

In terms of execution, just paste this into your Terminal:

$ sudo apt-get -y install cowsay lolcat # Linux only
$ brew install cowsay fortune # Mac / OSX only. Install Homebrew if this doesn't work
$ gem install lolcat
$ fortune | cowsay | lolcat

Thats it!

For a random cow with a random quote on new sessions, then do this (you may need to edit if you’re not using bash or your profile’s somewhere else):

$ cat << 'EOM' >> ~/.bash_profile
#random cow to say random things
cowlist=( $(cowsay -l | sed "1 d") );
thechosencow=${cowlist[$(($RANDOM % ${#cowlist[*]}))]}
fortune | cowsay -f "$thechosencow" | lolcat


Now on Terminal starts, you get something like this:

Inspired and edited from this gist and this post, which unfortunately required you to have node installed as well, so I’ve edited the code to be more portable on different systems