fortune is a classic Unix application and quite old. In order to make the life of a Unix admin and user a bit more fun people developed databases of quotes and sayings from various sources. Upon login one of them is randomly chosen and displayed.

The most easiest way to integrate fortune into a system is to place the following code snipped into /etc/profile, .bashrc or .bash_login (or any other shell runcom file).

  echo
  /usr/games/fortune -s
  echo

This will use the systemwide fortune databases. You can also use custom files placed in a directory of your choice. Just add the filenames to the commandline.

Examples

To list all fortune files installed in your system, use "-f" to print files and "-a" to see them all (also the ones not safe for work):

  fortune -fa

Example output, showing each fortune file installed in your system, with its related display probability:

42,28% /usr/share/games/fortunes
    22,19% fortunes
     6,59% riddles
    13,49% literature
57,72% /usr/share/games/fortunes/off
     1,39% obsc-o
     0,05% norm-o
     8,81% zuse-o
     0,57% computer-o
     0,05% formiche-o
     0,05% paolotedeschi-o
     2,47% leggi-o
    34,76% italia-o
     3,71% film-o
     0,15% luke-o
     0,21% jackfr-o
     1,29% luttazzi-o
     4,22% definizioni-o

To show a specific set of fortune, for example to show the one called "off" (not safe for work), just add its name as main argument:

  fortune off

There are other options.

As usual, read the man page for information about each option.

Available Fortune Files

Note that Debian is shipped with an interesting set of fortune files. Some of them are language based.

For example, to install the Italian set not safe for work, just install its package:

apt install fortunes-it-off

Here a list of available fortunes:

https://packages.debian.org/search?suite=default&section=all&arch=any&searchon=names&keywords=fortunes-

Custom files