Electronic Fortune Cookies for Fun

Posted by:


Fortune is a simple program that displays a pseudorandom message from a database of quotations. In this blog, I am going to shown you that those electronic cookies -random poignat, inspirational, silly or snide phrases – can make your digital life surprisingly fun, just like a fortune cookies after meal.

Installation -fortune, cow and pony

Following installation guide is based on Arch Official site.

Display a piece of ASCII image

Bash can be made to display a piece of ASCII images, and display at a terminal on login, with following:

Display fortune cookie phrases with fortune-mode

To have a random phrase displayed when logging into a terminal, use:

Combine both with a Cow

and you can make the cow deliver the fortune cookie for you; or pick a different one from the list located in /usr/share/cows.

or, pick an ASCII image from online or design one yourself:

add to your ~/.bashrc:

Nice Eye Candy with more complex lines

If you prefers a pony (with color)


Get more fortunes from wikiquote

First, grap some premade ones

they will be stored in /use/share/fortune/

Generate fortuen yourself from Wikiquote with wikiquote-fortune


Install wikiquote-fortune

test it out, with a show name (the part follows after this https://en.wikiquote.org/wiki/):

Here is somthing I came up with to make life a bit easier

  1. Generate show file with your shows

  2. Use following script (getquote.sh) to generate the quotes

    NB: bash -x ./getquote to debug if needed. man fortune for more info.

  3. Make it excutable chmod +x, try it and enjoy!!
  4. copy the quotes and .dat file to user/share/fortune

    NB: does not work with quotes other than movies; some other script may be worthy of mention.

Retrieve wikiquote other than movies

The following is a python script I wrote to retrieve quotes from wikiquote.


Add a Comment