Fortune
fortune is a simple program that displays random poignant, inspirational, silly or snide phrase from a database of quotations. The fortune command-line utility is part of the fortune-mod package.
Contents
Installation
Install fortune-mod or fortune-mod-gitAUR.
Usage
- Command-line in a terminal:
$ fortune It is Texas law that when two trains meet each other at a railroad crossing, each shall come to a full stop, and neither shall proceed until the other has gone.
- To display a random quote when launching an interactive terminal, add the fortune command to the rc configuration file of your preferred shell:
#!/bin/bash # ~/.bashrc fortune
#!/bin/dash # ~/.dashrc fortune
- To display a random quote when logging into a login terminal, add the fortune command to the profile configuration file of your preferred shell:
#!/bin/mksh # ~/.profile fortune
Cowsay
Default cow with fortune
- Combined with the program cowsay:
$ cowthink $(fortune) ________________________________________ ( The best cure for insomnia is to get a ) ( lot of sleep. -W.C. Fields ) ---------------------------------------- o ^__^ o (oo)\_______ (__)\ )\/\ ||----w | || ||
- Display a potentially offensive fortune:
$ cowsay $(fortune -o) _________________________________ < Chastity is its own punishment. > --------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||
The ASCII images are generated by .cow
text files located in /usr/share/cows
, and all themes can be listed with the cowsay -l
. These files can be edited to the user's liking; custom images can also be created from scratch or found on the net. The easiest way create a custom cow file is to use an existing one as a template. To test the custom file:
$ cowsay -f /path/to/file $(fortune)
Random cow with fortune
$ fortune -c | cowthink -f $(find /usr/share/cows -type f | shuf -n 1) ___________________________________________ ( (computers) % A language that doesn't ) ( affect the way you think about ) ( programming is not worth knowing. ) ------------------------------------------------------ o (__) o /oo| o (_"_)*+++++++++* //I#\ \ \ \ \ \ \ \ I \ I[I|I | | | | | I I ` I`I ' / / / ' ' I I I I I I ~ ~ ~ ~ Scowleton
Random custom cow with fortune
Complex commands can be chained to produce detailed ASCII art sych as this Futurama example.
- Display a random cow with a random facial expression and wrap long lines of fortune text:
$ fortune -a | fmt -80 -s | $(shuf -n 1 -e cowsay cowthink) -$(shuf -n 1 -e b d g p s t w y) -f $(shuf -n 1 -e $(cowsay -l | tail -n +2)) -n ________________________________________ ( Fry: I must be a robot. Why else would ) ( human women refuse to date me? ) -------------------------------------------------- o o o ,'``.._ ,'``. :,--._:)\,:,._,.: :`--,@@@:`...';\ `,'@@@@@@@`---'@@`. /@@@@@@@@@@@@@@@@@: /@@@@@@@@@@@@@@@@@@@\ ,'@@@@@@@@@@@@@@@@@@@@@:\.___,-. `...,---'``````-..._@@@@|:@@@@@@@\ ( )@@@;:@@@@)@@@\ _,-. `. (@@@//@@@@@@@@@@`'@@@@\ : `.//@@)@@@@@@)@@@@@,@; |`. _,'/@@@@@@@)@@@@)@,'@,' :`.`-..____..=:.-':@@@@@.@@@@@_,@@,' ,'\ ``--....-)=' `._,@@\ )@@@'``._ /@_@`. (@) /@@@@@) ; / \ \`-.' (@@@`-:`. `' ___..'@@_,-' |/ `.) `-. `.`.``-----``--,@@.' |/`.\`' ,','); ` (/ (/
Ponysay
For full 256-colored cowsay-like art use ponysay (version 3.0 has 422 ponies). The syntax is the same, meaning $ ponysay message
to say something and ponysay -l
for a complete list of ponies. To select a pony to display, run $ ponysay --pony x "message"
, where x is a pony. To create more ponies use util-say-gitAUR and store them in ~/.local/share/ponysay/ponies
and ~/.local/share/ponysay/ttyponies/
for desktop and TTY, respectively.