Fortune, a wolderful application to make your Linux life more interesting

For those who are new to Linux, the terminal could be a very boring place to be in. To make the terminal fun and cool ( it actually is already), the Linux geeks have created a very interesting application called electronic fortune cookies. The main function of fortune is to display a random saying on the terminal, however today I will also show you some other creative ways to use fortune.

How to install

If you are using popular distros like Ubuntu or Linux Mint, installing fortune is a piece of cake since it is already in the respiratory, Just run sudo apt-get install fortune. ( If you want the extended package with more quotations and saying, run sudo apt-get install fortune-mod, or go the respiratory and search for additional packages of fortune in different languages). If you are using Archlinux, run sudo pacman -S fortune-mod

How to run and configure

To run fortune, simply type fortune on the terminal and a random saying will appear after you hit enter. These sayings are about everything, from art, philosophy to sport and sex jokes. And if you want to display only sayings in on specific category, for example art, you just need to run fortune art and only sayings about art will appear. You can check the image below for more information.

fortune linux terminal

The original sayings in the fortune package is usually funny and somtimes very enlightening. However, you could find them annoying, stupid and ridiculous. But the coolest thing in the Linux world is that if you dont like anything, you can change it or create a new one. Therefore in case you dont like the pre-made sayings of fortune or the sayings that you like are not there, you can create your own quotations database.

To do so, you first need to create a list of your favorite sayings with a text editor.  The important thing is that you have to end each saying with a percentage symbol (%). For example, I want to create a list of motivational quotes, the text file will look like this:

It was a high counsel that I once heard given to a young person, "Always do what you are afraid to do."
Ralph Waldo Emerson
Take calculated risks.
That is quite different from being rash.
George S. Patton
Storms make oaks take roots.
If you do not hope, you will not find what is beyond your hopes.
St. Clement of Alexandra

After that, I gave a text file a name, in my case it is motiv ( without any file tag), and saved it in my ~/Documents folder. The next step is to create a .dat file for the text file I just save, I ran
strfile  ~/Documents/motiv
and a motiv.dat file was created. And finally, I moved the two files I just created ( motiv and motiv.dat) to the fortune folder, I ran

sudo mv motiv motiv.dat /usr/share/fortune

( my current directory was already in ~/Documents ) and everything is done. To display the sayings I just added, I simply ran

fortune motiv

and the image below is what I got

* Note: if you are using Ubuntu, the fortune folder is /usr/share/games/fortune

Other cool ways to use fortune

The first cool way to use fortune is to get a random saying appearing when you open the terminal. To do so, you open the .bashrc file ( ~/.bashrc) and add the command fortune (or fortune saying-list) into it. For exampke, I add fortune motiv into .bashrc and I my terminal is like this when I open it.

You can also use fortune together with another fun package cowsay, to have the saying spoken by a cow drawn in ascii art, you install cow say first (sudo apt-get install cowsay if you use Ubuntu, or
sudo pacman -S cowsay if you are using Archlinux), after that add this command to the .bashrc file. And in the image below, I added fortune motiv -a | cowsay to .bashrc.

The other cool way is to use fortune with conky as a fortune cookies application on your desktop, you can configure it to make a saying appear randomly after some period of time. To do so, put this command  ${execi 30 fortune fran} into your conky config file ( execi means to execute a command, 30 is the interval time for the next saying to appear, you can edit the value of the interval time ). You can also customize the font and color of the saying as will with the conky variables. Here is my desktop using conky with fortune.


About pacesettergraam

A good and realistic person

Posted on September 13, 2012, in linux and tagged , , . Bookmark the permalink. 2 Comments.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: