CLI tool
shlomif/fortune-mod avatar
shlomif/fortune-mod

fortune-mod keeps the 1979 Unix fortune working on Linux, with a much larger quote set

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

559 stars75 forksCNOASSERTION

At a glance

What is it?
fortune-mod is a maintained fork of the NetBSD fortune command, ported to Linux, with its own large quote collection shipped in the download and installed by default, and a CMake build with tests and valgrind runs. It suits Linux users who want the classic fortune behaviour with a quote corpus that does not need a separate package, and it is a C program with a data format that few other tools read.
Who is it for?
Linux users who want the Unix fortune command with a quote collection that is already included rather than something they have to install separately, are the people fortune-mod is for, and the fact that the quotes ship in the download and are installed by default is the difference between a working fortune and a working fortune with an empty database.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 58 days ago.
What is it written in?
Mainly C, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

A fork of NetBSD fortune, ported to Linux and still recognisable

The lineage is spelled out in the history section. The author believes fortune-mod was originally forked from the NetBSD version of fortune and ported to run on Linux systems, and for some time it was maintained at a now offline site inside a GNU Arch repository, with version 1.99.1 released as a tarball. The maintenance version was initiated by Shlomi Fish, who decided to maintain it, given he is a fan of the fortune command, and it started by importing the unpacked source of the fortune-mod-1.99.1 tarball from the Mageia Linux source package into an empty git repository. The canonical repository is the one this project lives in for the time being, with a note that a GitHub organisation may be created in future and the sources moved there. The behaviour itself is unchanged in spirit, a command-line utility which displays a random quotation from a collection of quotes, read from the local file system and requiring no network access.

The quote corpus ships in the download, which is the real feature

Most of the value in the package is the data rather than the code, and the readme says so directly: most of the value, and the relative data size, of the tarball is in the quotes collection. A large collection of quotes is provided in the download and installed by default, and more quote collections can be added by the user. That is the practical difference from a distribution package that ships an empty database and asks you to install a separate collection, because in that case the program is useful only after a second package. The author also notes in passing that the distributions' own fortune executable may in fact be fortune-mod, and that on Debian and derivatives it is likely very out of date as of September 2020, which is the sort of detail that explains why a distribution's package and a maintained fork can behave differently on the same machine.

The runtime format is .dat indexes, and that is why the code is C

The readme gives an unusual and honest reason for the language choice. The original fortune was created in 1979, before the first version of perl was released in 1987, and before Python, Ruby or Lua existed, and when UNIX-running computers were more underpowered than they are today. Then there is the algorithmic point, which is the one that actually constrains reimplementations: fortune's runtime algorithm is not as straightforward as one may believe, making use of .dat files that contain counts and offsets of the fortune cookies. A native executable might still provide a better user experience, the author notes, while admitting he has yet to perform a stresstest benchmark and doubting it matters much for fortune's common use case. He also notes reimplementations exist in Perl, Python, Go and Rust, that they may work with the data files of fortune-mod and other collections, but that the source codes have not been closely reviewed.

Packages for four distributions, and the Debian split is worth reading

The install instructions cover the common rpm and deb based systems, and the Debian path is the one with a wrinkle. On Fedora and other rpm-based distributions it is a single dnf install of fortune-mod, with a note that RHEL and CentOS users may opt to try the EPEL packages. On Arch Linux and derivatives it is pacman. On Alpine there is a two step, an install script fetched over curl and piped into doas sh, then an apk add, with the note that this assumes doas and curl are installed and that you are not root. On Debian and derivatives there are two options, one that sets up a custom apt repository through a script and installs the fortune-mod-shlomif package, and one that installs the older fortune-mod package if you are content with a very old version. The readme is explicit that the first route makes sure you have the latest version. The commands themselves are short enough to state directly.

bash
sudo dnf install fortune-mod
bash
sudo pacman -S fortune-mod
bash
curl -sL https://swee.codes/repo.sh | sudo bash
sudo apt install fortune-mod-shlomif

Building from source with CMake, and what the tarballs are for

Building from sources points at the INSTALL.asciidoc file in the fortune-mod directory, with a suggestion to consult the GitHub Actions based continuous integration procedures. The build system was converted to CMake, and the readme links the pull request and a status post for that change. The reason it matters is the list of what was already done in the maintenance line, which reads as a changelog of the fork itself: the 1.99.1 sources imported from the Mageia tarball as the tag fortune-mod-1.99.1, the conversion of the build system to CMake, the conversion of the source files to UTF-8, the addition of tests, the removal of trailing whitespace, the reformatting of long lines, the fixing of typos, the addition of Travis-CI testing, the addition of valgrind tests and the fixing of some memory leaks. Release tarballs prepared by CPack are hosted on the author's own site, with the caveat that the auto-generated source code zip and tarball downloads should not be used because they are both incomplete and have extra directories inside.

The offline flag and the offensive flag are two different things

Two build options deserve attention because they are easy to confuse with each other. One is a build-time option to remove the -o flag, which the readme calls the offensive flag, inspired by a set of patches on the Fedora package. In the Unix fortune tradition, the -o option is what prints the offensive quotations, and being able to compile it out is a distribution-friendly choice, since some packagers and some sites do not want that content in the binary at all. The other thing called offline in the readme is not a build option at all, it is a description of the program, since the collection is read from the local file system and does not require network access. The other change worth noting in the same list is the application of downstream patches, which is a normal way for a maintained fork to pick up fixes from the distributions that ship it.

Where fortune-mod is the wrong choice

The first wrong case is a system that already has a fortune you are happy with, since the original Unix fortune still exists on BSD and on macOS, and the fork's justification is the quote collection rather than the program. The second is a user who wants to reuse a quote collection from another project, because the .dat files with their counts and offsets are specific to this lineage, and although the readme says the reimplementations in Perl, Python, Go and Rust may work with the data files of fortune-mod, the converse is not established. The third is a deployment where an outdated system package is acceptable, since the older fortune-mod package exists on Debian and derivatives and the maintainer explicitly says it is likely very out of date, which for a program whose whole purpose is a pleasant random quotation may be entirely acceptable. The fourth is anyone expecting a packaged, tested release pipeline for their own distribution, because the tarballs are prepared by CPack and uploaded by hand to the author's own site, so a distribution packager is carrying that work rather than a CI pipeline doing it.

Editorial conclusion

Linux users who want the Unix fortune command with a quote collection that is already included rather than something they have to install separately, are the people fortune-mod is for, and the fact that the quotes ship in the download and are installed by default is the difference between a working fortune and a working fortune with an empty database. It is the wrong choice for a non-Linux system that already ships the original fortune, and it is the wrong choice if you want to use a quote collection from another project, because the .dat index format is specific to this lineage. Check three things before you install it: which package to use, since the Debian and Ubuntu path offers two variants and one of them is described as possibly very out of date, whether the quote collection shipped in the download is the one you want, and where the executable lands, since the readme documents a case where fortune sits in an unusual path and has to be invoked by full path. The licence is a custom one, the newest release is 3.26.0 from 2026-01-18, and the last push was on 2026-08-26.

Frequently asked questions

How do I install fortune-mod on Linux?

On Fedora and other rpm based distributions it is sudo dnf install fortune-mod, on Arch it is sudo pacman -S fortune-mod, on Alpine it is an install script fetched with curl and run with doas sh followed by doas apk add fortune-mod, and on Debian and derivatives it is the swee.codes apt repository script plus sudo apt install fortune-mod-shlomif.

What is the difference between fortune-mod and the normal fortune command?

fortune-mod, meaning fortune modified, was the name of a fork of the original NetBSD fortune, done to port the code to Linux and apply other changes. The readme notes that if you use a Linux distribution, the fortune executable's package is likely already fortune-mod, although on Debian and derivatives it is likely very out of date as of September 2020.

Why is fortune-mod written in C?

The original fortune was created in 1979, before perl, Python, Ruby and Lua existed and when UNIX machines were more underpowered, and the runtime algorithm uses .dat files holding counts and offsets of the fortune cookies, which the readme notes is not as straightforward as one may believe.

Does fortune-mod need network access?

No. The collection of quotes 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, and more collections can be added by the user.

Where do I get official release tarballs of fortune-mod?

They are prepared by CPack and hosted in a directory on the author's own site, and they can also be downloaded from the GitHub releases page. The readme asks you not to use the auto-generated source code zip and tarball downloads, because both are incomplete and have extra directories inside.

Official sources

  1. Issues
  2. Project website
  3. README
  4. Releases
  5. shlomif/fortune-mod on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/shlomif-fortune-mod.svg)](https://hysenlabs.com/projects/shlomif-fortune-mod)

Was this useful?