First you need to install the fortune cookie applications and message files:
sudo apt-get install fortune-mod cowsay
You can test this has installed ok by typing the following:
fortune
and you should get a message displayed.
Next you need to create shell scipt that will do all the hard work for you - borrowed from the Mint guys
sudo vim /usr/bin/ubuntu-fortune
Here is what to put into the file
#!/bin/bash
RANGE=4
number=$RANDOM
let "number %= $RANGE"
case $number in
0)
cow="small"
;;
1)
cow="tux"
;;
2)
cow="koala"
;;
3)
cow="moose"
;;
esac
RANGE=2
number=$RANDOM
let "number %= $RANGE"
case $number in
0)
command="/usr/games/cowsay"
;;
1)
command="/usr/games/cowthink"
;;
esac
/usr/games/fortune | $command -f $cow
Now we need to make this file executable by doing this
sudo chmod +x /usr/bin/ubuntu-fortune
Then last but not least we need to place it into one of the shell script master files so that it gets called every time when you start up a shell script. So edit the following file, and place the command - /usr/bin/ubuntu-fortune - as the last entry in the file.
sudo vim /etc/bash.bashrc
Voila, when you now start a shell terminal , you will have something to laugh at, and you can of course just type the command we created above to get a laugh on got.
Here is an example:
Now there are lots of other fortunes you can install, some of them can be very rude, so be careful, and you can grab these either using apt-get or using the Synaptic package manager.
Have fun.