fortune (Unix)
   HOME

TheInfoList



OR:

fortune is a program that displays a
pseudorandom A pseudorandom sequence of numbers is one that appears to be statistically random, despite having been produced by a completely deterministic and repeatable process. Background The generation of random numbers has many uses, such as for rand ...
message from a database of quotations that first appeared in Version 7 Unix. The most common version on modern systems is the BSD fortune, originally written by Ken Arnold. Distributions of fortune are usually bundled with a collection of themed files, containing sayings like those found on
fortune cookie A fortune cookie is a crisp and sugary cookie wafer usually made from flour, sugar, vanilla, and sesame seed oil with a piece of paper inside, a "fortune", usually an aphorism, or a vague prophecy. The message inside may also include a Chine ...
s (hence the name), quotations from famous people, jokes, or poetry. As of November 2017, the quotations (with the exception of tips relevant to system operation) have been removed from FreeBSD entirely after user complaints regarding quotations from
Adolf Hitler Adolf Hitler (; 20 April 188930 April 1945) was an Austrian-born German politician who was dictator of Germany from 1933 until his death in 1945. He rose to power as the leader of the Nazi Party, becoming the chancellor in 1933 and the ...
being contained in some of the files. fortune is predominantly found on
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
systems, but clients for other platforms also exist. Often, users on text-mode Unix terminals will place this command into either their .profile or .logout files to display them at logon and logout, respectively. It is also used to generate text input for certain XScreenSaver modes. It is possible to pipe fortune into the cowsay command, to add more humor to the dialog.


Content

Most Unix systems use fortunes which are slanted heavily toward the user base of Unix, and thus contain many obscure jokes about
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to Applied science, practical discipli ...
and
computer programming Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as anal ...
. Other favoured sources include quotations from
science fiction Science fiction (sometimes shortened to Sci-Fi or SF) is a genre of speculative fiction which typically deals with imaginative and futuristic concepts such as advanced science and technology, space exploration, time travel, parallel uni ...
(''
Star Trek ''Star Trek'' is an American science fiction media franchise created by Gene Roddenberry, which began with the eponymous 1960s television series and quickly became a worldwide pop-culture phenomenon. The franchise has expanded into vari ...
'', ''
The Cyberiad ''The Cyberiad'' ( pl, Cyberiada) is a series of humorous science fiction short stories by Polish writer Stanisław Lem, originally published in 1965, with an English translation appearing in 1974. The main protagonists of the series are Trurl a ...
'', ''
Doctor Who ''Doctor Who'' is a British science fiction television series broadcast by the BBC since 1963. The series depicts the adventures of a Time Lord called the Doctor, an extraterrestrial being who appears to be human. The Doctor explores the ...
'', '' The Hitchhiker's Guide to the Galaxy'', etc.),
Zippy the Pinhead Zippy the Pinhead is a fictional character who is the protagonist of ''Zippy'', an American comic strip created by Bill Griffith. Zippy's most famous quotation, "Are we having fun yet?", appears in ''Bartlett's Familiar Quotations'' and became a ...
, and the writings of
Ambrose Bierce Ambrose Gwinnett Bierce (June 24, 1842 – ) was an American short story writer, journalist, poet, and American Civil War veteran. His book ''The Devil's Dictionary'' was named as one of "The 100 Greatest Masterpieces of American Literature" by t ...
and
Dave Barry David McAlister Barry (born July 3, 1947) is an American author and columnist who wrote a nationally syndicated humor column for the ''Miami Herald'' from 1983 to 2005. He has also written numerous books of humor and parody, as well as comi ...
. Most fortune collections also include a wide variety of more conventionally sourced quotations, jokes, and other short passages. A few distributions include "offensive" dicta, which require the -a or -o options to be passed for viewing. These fortunes often include rude humor and profanity, personal attacks, and controversial comments about religion. Sometimes they are provided by another package, however as of FreeBSD 10.0 the offensive dicta have been removed completely. The exact fortunes vary between each type of Unix, however there seems to be a strong overlap between the
FreeBSD FreeBSD is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution (BSD), which was based on Research Unix. The first version of FreeBSD was released in 1993. In 2005, FreeBSD was the most popular ...
and
OpenBSD OpenBSD is a security-focused, free and open-source, Unix-like operating system based on the Berkeley Software Distribution (BSD). Theo de Raadt created OpenBSD in 1995 by forking NetBSD 1.0. According to the website, the OpenBSD project e ...
fortune files. The Plan 9 fortune files seem to be much shorter, with many just on 1 line, and the 'offensive' dicta is much stronger. Most Linux distributions, such as Debian (and its derivatives), choose the FreeBSD fortunes to put in their fortune packages, that can be installed through the package manager.


Purpose

One of the included fortunes, from the "goedel" collection of fortunes about fortune itself, sums up the purpose of the program: The original fortune program could be used for the more general task of picking up a random line from a plain-text file. The example of such use is given in th
rc documentation
However, in most modern Unix systems fortune cannot be used this way, since they use an ad hoc file format for fortune files to allow multiline aphorisms.


Fortune files

Conventional versions of fortune use two files for each quotation list: a text file with quotations, each separated by the character "%" on its own line, and a random-access data file generated by the strfile(1) program. Alternative implementations, including those made for display on Web pages, typically use only the text file.


Common options

Several common options exist that change the way command-line versions of fortune behave:


See also

*
QOTD The Quote of the Day (QOTD) service is a member of the Internet protocol suite, defined in RFC 865. As indicated there, the QOTD concept predated the specification, when QOTD was used by mainframe sysadmins to broadcast a daily quote on request b ...


References


External links

* *
A PHP version of the fortune program

The manual page for the original Unix fortune(6) command

Maintenance version of fortune-mod's source code
- on
GitHub GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, cont ...
with new releases ** ftp://ftp.ibiblio.org/pub/linux/games/amusements/fortune/ – source code for fortune-mod program
A wiki containing all of the original non offensive fortunes

A modern, color-terminal oriented fortune database

A fortune-mod add on for math-related fortunes

A portable and full implementation in Python
distributed with all th
classical
an
historical cookie files
{{Plan 9 commands 1979 software Unix software Novelty software Free and open-source Android software Plan 9 commands