fortune
is a uncomplicated computer program that displays a pseudorandom message from a database of quotations that kickoff appeared inwards Version vii Unix. The most mutual version on modern systems is the BSD
fortune
, originally written yesteryear Ken Arnold. Distributions of fortune are commonly bundled amongst a collection of themed files, containing sayings similar those constitute on fortune cookies (hence the name), quotations from famous people, jokes, or poetry.
cowsay
is a computer program which generates ASCII pictures of a moo-cow amongst a message. It tin too generate pictures using pre-made images of other animals, such every bit Tux the Penguin, the Linux mascot. Tony Monroe is credited every bit the master copy author. Since it is written inwards Perl, it is adaptable to other systems such every bit Microsoft Windows. .cow files for cowsay be which are able to create unlike variants of “cows”, amongst unlike kinds of “eyes”, in addition to so forth. It is sometimes used on IRC, desktop screenshots, in addition to inwards software documentation. It is to a greater extent than or less a joke inside hacker culture, but has been roughly long plenty that its purpose is rather widespread. In 2007 it was highlighted every bit a Debian packet of the day.
Fortune in addition to Cowsay – random quotes in addition to animals
Normally all the guides using fortune
in addition to cowsay
uses the default creatures (a.k.a Cow
!) to demo unlike quotes. There’s plenty of guides on that. However, I wanted to demo a random creature proverb unlike fortune quotes on my terminal.I could discovery random figment of instructions inwards unlike forums in addition to decided to write a pocket-size guide on how to attain it properly. Few lines of codes, in addition to my Linux finally becomes to a greater extent than alive!
If you’re non familiar amongst fortune
in addition to cowsay
in addition to so cash inwards one's chips along reading for details otherwise you lot tin only saltation into the code section.
Install Fortune
You tin install fortune
inwards Debian, Ubuntu or Kali Linux or whatever aptitude/apt-get based distro using the next command:
apt-get install fortune
(or)
sudo apt-get install fortune
Usually fortune
is available inwards all the basic touchstone repositories, otherwise only add together them for your respective Linux version.
You tin install fortune
inwards Redhat, CentOS, Fedora of whatever yum based Linux distros using the next command:
yum install fortune
(or)
sudo yum install fortune
If you lot accept a unlike distro, the ascendance is pretty much the same.
Once installed you lot tin only type inwards fortune
inwards your finally in addition to you lot larn a random quote or joke.
List in addition to place of fortune files
Fortune quotes in addition to files are located here:
ls -l /usr/share/games/fortunes/
Install Cowsay
You tin install cowsay
inwards Debian, Ubuntu or Kali Linux or whatever aptitude/apt-get based distro using the next command:
apt-get install cowsay
(or)
sudo apt-get install cowsay
Just similar fortune, cowsay
is available inwards all the basic touchstone repositories, otherwise only add together them for your respective Linux version.
Similar to fortune, you lot tin install cowsay
inwards Redhat, CentOS, Fedora of whatever yum based Linux distros using the next command:
yum install cowsay
(or)
sudo yum install cowsay
If you lot accept a unlike distro, the ascendance is pretty much the same.
Type inwards cowsay a sentence/word
in addition to a moo-cow volition repeat that inwards your terminal.
Exciting! Influenza A virus subtype H5N1 talking moo-cow … Well I approximate I could cash inwards one's chips in addition to lookout adult man a moving-picture demo now!
List in addition to place of cowsay files
cowsay creatures are located here:
root@kali: # ls /usr/share/cowsay/cows/
apt.cow ghostbusters.cow sheep.cow
beavis.zen.cow gnu.cow skeleton.cow
bong.cow head-in.cow snowman.cow
bud-frogs.cow hellokitty.cow sodomized-sheep.cow
bunny.cow kiss.cow stegosaurus.cow
calvin.cow kitty.cow stimpy.cow
cheese.cow koala.cow suse.cow
cock.cow kosh.cow three-eyes.cow
cower.cow luke-koala.cow turkey.cow
daemon.cow mech-and-cow.cow turtle.cow
default.cow meow.cow tux.cow
dragon-and-cow.cow milk.cow unipony.cow
dragon.cow moofasa.cow unipony-smaller.cow
duck.cow moose.cow vader.cow
elephant.cow mutilated.cow vader-koala.cow
elephant-in-snake.cow pony.cow www.cow
eyes.cow pony-smaller.cow
flaming-sheep.cow ren.cow
root@kali: #
Random Fortune in addition to Cowsay inwards Linux terminal
Now it’s fourth dimension to seat everything together. You accept 2 options.
- You tin add together random fortune in addition to cowsay for a unmarried user
- You tin add together random fortune in addition to cowsay for all users.
Option 1. Random fortune in addition to cowsay for unmarried user
To add together random fortune
in addition to cowsay
for a unmarried user, you lot remove to edit .bashrc
file inwards the users domicile directory.
vi /.bashrc
Now add together the next trouble at the bottom of the file:
if [ -x /usr/games/cowsay -a -x /usr/games/fortune ]; then
fortune | cowsay -f $(ls /usr/share/cowsay/cows/ | shuf -n1)
fi
Save in addition to exit. Reopen finally in addition to you lot volition run across a random creature quoting a unlike phrase/jokes for that user.
Option 2. Random fortune in addition to cowsay for all users
To add together random fortune
in addition to cowsay
for a all users, you lot remove to edit /etc/bash.bashrc
file
vi /etc/bash.bashrc
Now add together the next trouble at the bottom of the file:
if [ -x /usr/games/cowsay -a -x /usr/games/fortune ]; then
fortune | cowsay -f $(ls /usr/share/cowsay/cows/ | shuf -n1)
fi
Save in addition to exit.
Reopen finally in addition to you lot volition run across a random creature quoting a unlike phrase/jokes for all users globally.
Little explanation close the code above
This code snippet is meliorate every bit it checks whether cowsay
in addition to fortune
exists inwards your system. So Line 1
does that…
if [ -x /usr/games/cowsay -a -x /usr/games/fortune ]; then
Line 2
uses fortune in addition to and so pipes
the quote to cowsay
. But default cowsay
would exclusively purpose a moo-cow to state the quote. We are using random creatures hither using shuf -n1
to rotate files inwards /usr/share/cowsay/cows/
folder.
fortune | cowsay -f $(ls /usr/share/cowsay/cows/ | shuf -n1)
And of course of pedagogy Line 3
is cease of the loop.
fi
The outcome
So how does it await similar at the end? Here’s few screenshots:
And of course of pedagogy for me every bit a Kali Linux user, Dragon!!
Hope you lot discovery this piddling guide useful. Enjoy in addition to don’t forget to share.