Hi linux geeks!
In this article I will teach you a nice trick you can perform in the terminal with the help of cowsay and fortune tools. But before going any further, let me tell you guys something about these tools and how to install them in your machine.
cowsay, what is it? If we analyze the name, we can jump into the conclusion that this tool has to do with a cow that says something and it is completely true. The cow displays in the terminal screen something provided by the user as the input. No arguments, only standard input and you are ready to go. How to install cowsay in Ubuntu?
Well, it is very easy! Open a new terminal(CTRL+ALT+T) and run the following command.
$ sudo apt-get install cowsay
After you have installed the tool, run another command in the terminal to test if cowsay works and also to print something you like to see in the terminal screen.
$ cowsay hello from unixmen
Now that you guys know what cowsay is, we should explain and test the fortune tool. fortune is a nice tool that can be used to print a random proverb or saying with the intention of being interesting to the reader. It is a tool with many options, but a nice thing about it is that it can also be used without any option. Install the fortune tool with the following command.
$ sudo apt-get install fortune
Are you ready for some fun? The first time i tried the fortune tool, I became addicted to it and couldn’t stop tying again and again only to read different adages.
Is the phrase long? Ok, use the fortune tool with the -s option to select and display short apothegms only. The following command will do it for us.
$ fortune -s
Now it is time for a smart tip! Can we combine fortune with cowsay in order to produce a nice output? Yes we can! We need only one pipeline to do that.
$ fortune | cowsay