Add a Little Fun to the Shell

It takes as little as to write the command fortune within the startup script .bashrc, which is a hidden text file in the home folder.

All we get is to see some funny sayings every time we open up a Bash shell.

First, let’s install fortune and try it.

$ sudo apt-get install fortune
$ fortune
You'll never see all the places, or read all the books, but fortunately,
they're not all recommended.

Second, put the command fortune to the last line of .bashrc using nano or any other text editor.

$ nano $HOME/.bashrc

Make it Funnier

Let’s install cowsay, and make it work together with fortune.

$ sudo apt-get install cowsay
$ fortune | cowsay
 _________________________________
/ You will engage in a profitable \
\ business activity.              /
 ---------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

You can also change the cow by using the -f option with one of the following cowfiles:

apt bud-frogs bunny calvin cheese cock cower daemon default dragon dragon-and-cow duck elephant elephant-in-snake eyes flaming-sheep fox ghostbusters gnu hellokitty kangaroo kiss koala kosh luke-koala mech-and-cow milk moofasa moose pony pony-smaller ren sheep skeleton snowman stegosaurus stimpy suse three-eyes turkey turtle tux unipony unipony-smaller vader vader-koala www

For example, let’s use the duck.

fortune | cowsay -f duck
 _________________________________________
/ Of course you have a purpose -- to find \
\ a purpose.                              /
 -----------------------------------------
 \
  \
   \ >()_
      (__)__ _

Finally, let’s pick random cows!

$ fortune | cowsay -f `ls /usr/share/cowsay/cows/ | shuf | head -n 1`
 ________________________________________
/ You possess a mind not merely twisted, \
\ but actually sprained.                 /
 ----------------------------------------
 \     /\  ___  /\
  \   // \/   \/ \\
     ((    O O    ))
      \\ /     \ //
       \/  | |  \/ 
        |  | |  |  
        |  | |  |  
        |   o   |  
        | |   | |  
        |m|   |m| 

Read also “Unix Philosophy with an Example” to learn how to compose multiple shell tools into one command as seen in this post.


© 2024 Massimo Nazaria

RSS

Licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.