Need help with fortune-mod?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

193 Stars 29 Forks Other 533 Commits 0 Opened issues


Implementation of the Unix fortune command for displaying a random quotation, for Linux and other systems.

Services available


Need anything else?

Contributors list

== fortune-mod Maintenance Version and Ongoing Development

[link=] image::[Travis-CI Build Status]

[link=] image::[AppVeyor Build status]

This GitHub repository maintains the sources for fortune-mod, a version of[the UNIX fortune command].

is a command-line utility which displays a random quotation from a collection of quotes. This collection is read from the local[file system] and does not require network access. A large collection of quotes is provided in the download and installed by default, but more quote collections can be added by the user.

The canonical repository for the time being is: . In the future, we may create a GitHub organization for it and move the sources there.

For more information about it, you can contact[Shlomi Fish] .

=== Installation

On Fedora and other rpm-based distributions:

.... sudo dnf install fortune-mod ....

( RHEL and CentOS users may opt to try[the EPEL packages]. )

On Arch Linux and derivatives:

.... sudo pacman -S fortune-mod ....

On Debian, and derivatives (e.g: Ubuntu, Linux Mint):

.... sudo apt install fortune-mod ....

(Warning: may be an old version.)

=== Release Tarballs

Release tarballs can be found at[this directory] for now.

Based on[this reported bug]:

One can find the official release tarballs of fortune-mod as prepared by CPack there. They have a proper containing directory. One can also download these tarballs from the[GitHub releases page] but please do not use the auto generated “Source code (zip)” and “Source code (tar.gz)” downloads which are both incomplete and have extra directories inside.

=== Sample usage

.... $ fortune Enthusiasm is one of the most important ingredients a volunteer project runs on. -- Andreas Schuldei $ ....

=== History

I believe fortune-mod was originally forked from the NetBSD version of fortune, and ported to run on Linux systems. For some time it was maintained at the currently offline redellipse-dot-net inside a Arch repository, and version 1.99.1 was released as a tarball.

This maintenance version was initiated by Shlomi Fish, who decided to maintain it out of being a fan of the fortune command. It started by importing the unpacked source of the fortune-mod-1.99.1.tar tarball from the Mageia Linux .src.rpm into an empty git repository and continuing from there.

=== What is the difference between fortune-mod and the "normal" fortune?

fortune-mod (= "fortune modified") was the name of a fork of the original NetBSD fortune, which was done in order to port the code to Linux and apply some other changes. If you are using a Linux distribution chances are that the

executable's package is fortune-mod (although in the case of Debian-and-derivatives it is likely very out-of-date as of September 2020).

=== Why is it written in C? Can't it be written in Perl, awk, Python, etc.?

The answer has several parts:

First of all note that according to[the wikipedia page] the original fortune was created in 1979, before the first version of perl was released in 1987, or python, ruby or Lua which were released later, and when UNIX-running computers were more underpowered than they are today.

Secondly, you can find some reimplementations of fortune here:


You may be able to get them to work with the data files of fortune-mod and other fortune collections, but note that we have not closely reviewed their source codes.

Thirdly, most of the value (and relative data size) of the tarball is in the quotes collection.

Fourthly, a native executable may still give a user experience

Finally note that the runtime algorithm is not as straightforward as one may believe, making use of dat files that contain counts and offsets of the fortune "cookies".

=== Why did you convert the buildsystem to CMake?



== What was already done.

. fortune-mod-1.99.1 was imported into the repository from the Mageia tarball as the tag

. . Converted the build system to[CMake] . . Converted the source files to UTF-8. . Added some tests. . Removed trailing whitespace. . Reformatted long (> 80 chars) lines. . Fixed some typos. . Added[Travis-CI] testing. . Added valgrind tests and fixed some memory leaks. . Released fortune-mod-1.99.3, fortune-mod-1.99.4, v2.0.0 and up to version 2.26.0 . Fixed some C compiler warnings encountered with the GCC compiler flags of[ShlomifCommon]. . Added a build-time option to remove the “-o” (= “offensive”) flag, inspired by a set of patches on the Fedora package. . Applied some downstream patches. . Fixed as many “clang -Weverything” warnings as possible. . lib-recode became maintained again at (thanks to @rrthomas ) thus preventing a switch to something else. . Got the build and tests to pass on Windows. . Found and fixed some security issues: * Seems to affect some Linux distributions as well as FreeBSD and NetBSD. ** Was already fixed in OpenBSD * * * * * * . Reformatted the C code using[clang-format].

== What remains to be done.

. See if there are any more downstream patches to apply. . Fix more typos (reports and pull-requests are welcome.) . Perhaps modernize the code a little. . Add more quotes / fortune cookies. . Prepare packages for the new releases for[downstream distributions/Operating Systems].

== Links

  •[Shlomi Fish’s Fortune Cookie Files] - on his site, containing links to many other collections of fortune cookies.
  • an XML grammar for collections of quotes, allowing one to generate XHTML or plaintext.
  •[’s web interface to fortune]
  • with many collections.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.