cowsay:How to make a cow talk on terminal startup

January 17, 2011 at 6:04 pm (console based, linux apps) (, , , , , , , )

Cowsay/cowthink (visit homepage at http://www.nog.net/~tony/warez/cowsay.shtml )

My hacked terminal startup using cowsay and figlet

Now you know what they use in Linux Mint to make a cow “talk” when the terminal starts :). I’m going to tell you how to do it in a much more awesome way. The programs they use are cowsay and fortune-mode. Cowsay can show any string, a text output of a command,program to appear as a dialog generated by an ascii art (including cow).

You can install program by

sudo apt-get install cowsay (in debian-based systems)

yum install cowsay (rpm based sytems)

Now try these in the terminal

cowsay “$USER is my boyfriend” ($ shows string value of environmental variable USER)

ls | cowsay (output of ls is piped to cowsay)

There are options to decide the appearance of the cow and its eyes. For example the switch -d will cause the cow to appear dead. But the most important hack can be done by -f which forces to use a files called cowsay files, so that we can get anything other than cow. Type

cowsay -l

to find the path of these files. Try each file with following syntax

cowsay -f <cowfile name, without extension> <string to display>

ex: cowsay -f tux $USER

The cowfiles can be edited to appear as we want. Only edit the stuff rounded by the circle. Do not edit anything else, and save by giving a different file name. Or we can simply download an ascii art from internet and replace the stuff in rounded area.

Editing a cowfile - only edit stuff on the red area

 

You can download ascii arts from sites like http://www.chris.com/ascii/ or simply you can build your own using these programs http://www.ascii-art.de/tools/. I’m not going to mention about them here. But the program Jave5 is a good one with a easy to use GUI, and runs on linux.

http://www.jave.de/download/download.html

Linux mint uses an additional program called fortune-mod to get’s stuff. Other than the command cowsay, cowthink can be used to appear like the cow is thinking, not speaking.

Fortune-mod (The classic fortune cookie program)

Fortune-mod is so far the funniest FOSS program i have come across with. It generates a random text string of a joke, a saying by a great person, something useful etc… Can’t be saying it all just try it by yourself. I haven’t seen the same thing twice after using it for some time.

Sudo apt-get install fortune-mod (for debian based systems)

yum install fortune-mod (for rpm based systems)

to use type fortune in the command line.

This can piped to above cowsay easily

ex: fortune | cowsay

a fortune | cowsay piped output

for other options of fortune, refer man pages.

Making the cow talk

To make this show on terminal startup (or run any program) you can put the above command in your bashrc file.

gedit ~/.bashrc

and add above commands, as you wish in it. You can add figlet command too. Open a new terminal to see the change.

So, mine produced something like the first picture in this post by these commands

cd ~/Desktop/figlet222/

./figlet -c -f script “lmpeiris rocks”

fortune | cowsay -f love

cd ~

Permalink Leave a Comment