Print a Random Quote With fortune

Show a random aphorism, joke or proverb each time fortune runs.

macOSrandomTerminalscriptingLow risk
Run fortune to print a random quotation; add -s to limit output to short entries.

01Command

Command
$ fortune -s

02What it does

fortune reads one of several text databases and prints a random entry, which is why it often appears in shell startup files and MOTD banners. Short mode -s avoids wall-of-text results, and -o picks offensive-classic instead of the default database. Combine it with cowsay for the classic greeting.

03Risk

RiskLow risk
Requirementsbrew install fortune
CompatibilitymacOS with Homebrew installed
!Warning: Some databases contain quotes that may be unsuitable for shared logs; -o specifically selects the adult database.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Homebrew formula: fortune
    Homebrew · vendor-doc · 2026-09-20
    Evidence: Installs the fortune command with a bundled collection of quote databases.
  • fortune(6) — Debian manpage
    Debian · technical · 2026-09-20
    Evidence: Documents the fortune command, its databases and the -s short mode.

Last verified: 2026-09-20 · Category: Developer

06Related solutions