Fortunes

The UNIX fortune program is a simple program that displays one random line of text from a file. These text files are fortune files because they contain cookies. A cookie is randomly chosen and displayed. The fortune program was designed to display a humorous, cynical remark or idea when a user logs in or logs out. The purpose was to difuse project tensions.

In modern times, most fortune programs are actually BSD style, supporting multi-line fortunes delimited by \n%\n. Modern BSD style fortune programs use a random access file to increase the speed at which fortunes can be displayed.

I have collected many fortune files and have made them available over the web. Select any of the links to choose a category. The random link will randomly select a category and choose a fortune from that category display. Refreshing the page will load a new fortune. Clicking the link at the top of the fortune page will allow you to download that file for offline use.

Be aware, the offensive fortune files are offensive. Please please please only click on them if you are willing to take offense. Additionally, some of the non-offensive files may contain offensive content. I have not audited them. Don't complain about it if your feelings get hurt, just stop clicking on it.

Available files

art 
ken 
law 
rob 
rsc 
tao 

Fortunes in your terminal

Each fortune file is listed out here. To view one specific fortune file, copy it's url but replace fortunes-html with fortunes-term. Or, you can choose not to add the GET request for a random fortune file each time

# GNU/Linux, OpenBSD
$ curl https://0x19.org/fortune/fortune-term.php?file=random

# FreeBSD
$ fetch -o - https://0x19.org/fortune/fortune-term.php?file=random

# Plan 9
% hget 'https://0x19.org/fortune/fortune-term.php?file=random'

Using these fortune files locally

Since these are BSD style fortunes, we need to make a quick lookup database. Download one of these fortune files (ascii-art as the example).

# GNU/Linux
$ dnf install fortune-mod
$ strfile ascii-art 
$ cp ascii-art.dat ascii-art /usr/share/games/fortune/
$ fortune ascii-art

# OpenBSD
$ strfile ascii-art 
$ cp ascii-art.dat ascii-art /usr/share/games/fortune/
$ fortune ascii-art

# FreeBSD
$ strfile ascii-art 
$ cp ascii-art.dat ascii-art /usr/local/share/games/fortune/
$ fortune ascii-art

Plan 9's fortune program does not support BSD style fortune files. So I wrote my one. Use bsdfortune

% bsdfortune /path/to/fortune/file

The backend powering this website is licensed under the BSD 2 clause. Source code is available here.