Fortune
Configuration
Along with colors, system info and ASCII symbols, Bash can be made to display a piece of ASCII art on login. ASCII images can be found online and pasted into a text file, or generated from scratch. To set the image to display in a terminal on login, use:
~/.bashrc
cat /path/to/text/file
Random poignant, inspirational, silly or snide phrases can be found in fortune-mod.
$ 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 have a random phrase displayed when logging into a terminal, use:
~/.bashrc
command fortune
These two features can be combined, using the program cowsay:
command cowsay $(fortune)
The earth is like a tiny grain of sand,
only much, much heavier.
-----------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
(user@host)-(10:10 AM Wed Dec 22)
--(~))--->
command cowthink $(fortune)
( The best cure for insomnia is to get a )
( lot of sleep. -W.C. Fields )
----------------------------------------
o ^__^
o (oo)\_______
(__)\ )\/\
||----w |
|| ||
(user@host)-(10:10 AM Wed Dec 22)
--(~))--->
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)
This can produce some nice eye candy, and the commands used can be more complex. For a specialized example, take a look here. Another example, to use a random cow, random facial expression, and nicely wrap the text of long fortunes:
command 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
,'``.._ ,'``.
:,--._:)\,:,._,.:
:`--,''@@@:`...';\
`,'@@@@@@@`---'@@`.
/@@@@@@@@@@@@@@@@@:
/@@@@@@@@@@@@@@@@@@@\
,'@@@@@@@@@@@@@@@@@@@@@:\.___,-.
`...,---'``````-..._@@@@|:@@@@@@@\
( )@@@;:@@@@)@@@\ _,-.
`. (@@@//@@@@@@@@@@`'@@@@\
: `.//@@)@@@@@@)@@@@@,@;
|`. _,'/@@@@@@@)@@@@)@,'@,'
:`.`-..____..=:.-':@@@@@.@@@@@_,@@,'
,'\ ``--....-)=' `._,@@\ )@@@'``._
/@_@`. (@) /@@@@@) ; / \ \`-.'
(@@@`-:`. `' ___..'@@_,-' |/ `.)
`-. `.`.``-----``--,@@.'
|/`.\`' ,',');
` (/ (/
(user@host)-(10:10 AM Wed Dec 22)
--(~))--->
Random Cow with fortune
$ fortune -c | cowthink -f $(find /usr/share/cows -type f | shuf -n 1)