fortunes: Fortune cookies for all
April 1st, 2007 edited by TinchoEntry submitted by Gaurav Vaidya. DPOTD needs your help, please contribute !
Fortune cookie programs store long lists of quotes, sayings, aphorisms, adages, IRC transcripts, and any other text which might be interesting. Since time immemorial (okay, okay, since 1979) Unix users have added fortune cookies to their .bashrc
(or equivalent) files, displaying a random quote every time a terminal is created. Quotes are drawn from subjects and sources of interest to geeks, from William Shakespeare to Douglas Adams, from Ambrose Bierce to Ziggy, from Linus Torvalds to the Fortune editors themselves.
On Debian/Ubuntu, the fortune cookie program of choice is available through the package fortunes.
Usage
The program is ridiculously simple to run: executing /usr/games/fortune
(or /usr/bin/fortune
) displays a pithy quote:
"I assure you the thought never even crossed my mind, lord." "Indeed? Then if I were you I'd sue my face for slander." -- Terry Pratchett, "The Colour of Magic"
Or perhaps something insightful:
It's hard to tune heavily tuned code. :-) -- Larry Wall in <199801141725.JAA07555@wall.org>
Or even self-referential:
This fortune would be seven words long if it were six words shorter.
Although the program works fine without any arguments, the following
may be helpful:
-o
- Display only offensive fortunes (you will need to install the offensive fortunes first; they are available in the fortunes-off package).
-a
- Display both offensive and non-offensive fortunes.
-w
- Wait for a while after displaying the comment, but before exiting. The amount of time waited depends on the number of characters in the fortune displayed; longer quotes will be ‘waited for’ longer. Very nice for scripting; for instance, running
while true; do fortune -w; done;
in a Bourne shell will display fortune after fortune, with a convenient pause after each one. My preferred script,while true; do echo === `date` ===; fortune -w; echo; done;
will do the same, except with a time-stamp at the top of each fortune.
Installing
To install, you will need to install the fortunes package. This package contains 15,000 quotes itself, and depends upon fortune-mod, which contains the executables, and fortunes-min, which contain other fortunes. These packages have been available in Debian and Ubuntu since long ago.
Other packages (available for both Debian and Ubuntu) allow you to install quotes in Chinese, Bulgarian, Portuguese, Czech, Slovak, German, Esperanto, Spanish, French, Gaelige (Irish), Italian, and Polish, as well as Debian hints and BOFH excuses.
The quotes used in this submission are from fortune-mod version 9708.
Posted in Debian, Ubuntu | 8 Comments »