FORTUNE(1)

πŸ“¦ version 1.053, in alpine 3.24

πŸ“ NAME πŸ“

fortune β€” print a random, hopefully interesting, adage. (Yep bestie, this is the fortune(1) page πŸ’–)

✨ SYNOPSIS ✨

fortune [-adefilosvw] [-n length] [-m pattern] [[N%] file/dir/all]

πŸ’– DESCRIPTION πŸ’–

When fortune is run with no arguments it prints out a random epigram. Epigrams are divided into several categories, where each category is subdivided into those which are potentially offensive and those which are not.

πŸ’… OPTIONS πŸ’…

Okay so here’s the whole flag menu, no skips, no cap:

  • -a β€” Choose from all lists of maxims, both offensive and not. (See the -o option for more information on offensive fortunes.)
  • -d β€” Enable debug messages.
  • -e β€” Consider all fortune files to be of equal size (see the discussion below on multiple files).
  • -f β€” Print out the list of files which would be searched, but do not print a fortune.
  • -l β€” Long dictums only. See -n on how β€œlong” is defined in this sense.
  • -m pattern β€” Print out all fortunes which match the regular expression pattern. See perlre(1) for a description of patterns.
  • -n length β€” Set the longest fortune length (in characters) considered to be β€œshort” (the default is 160). All fortunes longer than this are considered β€œlong”. If you set the length too short and ask for short fortunes, or too long and ask for long ones, you will get an error.
  • -o β€” Choose only from potentially offensive aphorisms. Please, please, please request a potentially offensive fortune if and only if you believe, deep down in your heart, that you are willing to be offended. (And that if you are, you’ll just quit using -o rather than give us grief about it, okay?)
... let us keep in mind the basic governing philosophy of The Brotherhood, as handsomely summarized in these words: we believe in healthy, hearty laughter -- at the expense of the whole human race, if needs be. Needs be. --H. Allen Smith, "Rude Jokes"
  • -s β€” Short apothegms only. See -n on which fortunes are considered β€œshort”.
  • -i β€” Ignore case for -m patterns.
  • -v β€” Show version number and exit.
  • -w β€” Wait before termination for an amount of time calculated from the number of characters in the message. This is useful if it is executed as part of the logout procedure to guarantee that the message can be read before the screen is cleared.

The user may specify alternate sayings. You can specify a specific file, a directory which contains one or more files, or the special word all which says to use all the standard databases. Any of these may be preceded by a percentage, which is a number N between 0 and 100 inclusive, followed by a %. If it is, there will be a N percent probability that an adage will be picked from that file or directory. If the percentages do not sum to 100, and there are specifications without percentages, the remaining percent will apply to those files and/or directories, in which case the probability of selecting from one of them will be based on their relative sizes.

As an example, given two databases funny and not-funny, with funny twice as big, saying

fortune funny not-funny

will get you fortunes out of funny two-thirds of the time. The command

fortune 90% funny 10% not-funny

will pick out 90% of its fortunes from funny (the β€œ10% not-funny” is unnecessary, since 10% is all that’s left). The -e option says to consider all files equal; thus

fortune -e

is equivalent to

fortune 50% funny 50% not-funny

πŸŽ€ FILES πŸŽ€

The manual literally lists these paths/files, bestie:

fortune readme ./fortunes ./fortunes/fortunes1 ./fortunes/fortunes2-o ./fortunes/fortunes2 ./fortunes/limerick ./fortunes/lwall ./fortunes/startrek ./fortunes/zippy

πŸ’€ BUGS πŸ’€

Currently there is no installer and the fortunes listed above are not included. Because of this, fortune might not find any files unless you specify them on the command line. Fr fr, that’s the whole bug note 😭

πŸ¦‹ TO DO πŸ¦‹

Bundle files and possibly make an installer.

πŸ‘‘ REVISION HISTORY πŸ‘‘

  • Revision 2.1 β€” 2006/01/16 β€” mike ciul
    • Enabled a lot of options
    • Fixed known bugs
    • Added -n option
  • Revision 1.0.1 β€” 1999/06/07 β€” andy murren
    • Small fixes and code clean up
    • FindBin now helps locate the directory of fortunes
    • Will search multiple files for a match
    • Dumped the -g option I tried in the original
  • Revision 1.0 β€” 1999/04/01 β€” andy murren
    • Initial Revision

🫢 AUTHOR 🫢

This Perl implementation of fortune was written by Andy Murren, andy@murren.org.

This program is covered by the GNU Public License (GPL). See <http://www.gnu.org/copyleft/gpl.html> for complete detail of the license.


Source/version vibe: perl v5.42.2, dated 2026-02-15, manual FORTUNE(1) β€” mwah πŸ’‹

πŸ“¦ where this page comes from