[ Sunday, 6 May 2007, axio ]
Ever wanted to type in text terminal somehow funnier? This article describes two programs that can be used to generate a little less standard output in Linux console: cowsay and figlet.
Author: Karol Kozioł “axio”
What is the ASCII-Art?
ASCII art is an artistic medium that relies primarily on computers for presentation and consists of pictures pieced together from the 95 printable (from a total of 128) characters defined by the ASCII Standard. For more information visit .
Installing the necessary software
If you are lucky, cowsay and FIGlet are already in the repositories of your distribution. This is so in Ubuntu, Debian and derivatives, as well as in many other systems. In order to install the required software in Ubuntu, just type the following in the terminal:
sudo apt-get install cowsay figlet
And after a few seconds you can use the programs. Of course you can use the Synaptic Package Manager to do the job, as well as multiple other alternatives for installing software in GNU/Linux.
Introducing Cowsay and Cowthink
Cowsay/Cowthink is a program generating ascii-cow (or other animals, as described later in the article) to present a text in similar way to the method used by comic artists. This way you can find out what ascii-animals think or say in relevant topics.
The difference between
cowthink is in the type of bubbles they generate. As you might have guessed these are speech bubbles for
cowsay and thought bubbles for
OK, so let’s start the show now:
This is the console output of the following command:
cowsay "Dragonia Magazine"
Except for this simple command, you can use many different options (switches) which will cause your text look a bit more attractive.
Let’s try this command:
cowsay -f name "sample_text"
It will generate sample_text with an animal defined with name.
The list of available ascii-animals can be found in /usr/share/cowsay-3.03/cows/ directory (as you see it is in version 3.03, the path can be different for other versions).
In my case:
returns the following list of files:
beavis.zen.cow hellokitty.cow small.cow bong.cow kiss.cow sodomized.cow bud-frogs.cow kitty.cow stegosaurus.cow bunny.cow koala.cow stimpy.cow cheese.cow kosh.cow supermilker.cow cower.cow luke-koala.cow surgery.cow daemon.cow mech-and-cow telebears.cow default.cow meow.cow three-eyes.cow dragon-and-cow.cow milk.cow turkey.cow dragon.cow moofasa.cow turtle.cow elephant.cow moose.cow tux.cow elephant-in-snake.cow mutilated.cow udder.cow eyes.cow ren.cow vader.cow flaming-sheep.cow satanic.cow vaderkoala.cow ghostbusters.cow sheep.cow www.cow head-in.cow skeleton.cow
Instead of name in the command, as demonstrated earlier, enter one of those file names, without extension (
.cow). One of my favorites is:
cowsay -f elephant-in-snake "Polish your GNU/Linux!"
Those who do remember “Little Prince”, will easily associate what I meant, the rest should visit the nearest library.
The another interesting way for introducing some diversity in our little
cow is to manipulate its eye shape. To do it use following options:
-b -d -t -y -g -p -s -w
Instead of describing those options, I suggest to run the program with one of them, and see in your own eyes what will happen (how our cow will change).
Another option enabling to define specifically the shape of eyes is:
For example, the command:
cowsay -e "QQ" "Dragonia Magazine"
Eyes do not have to be symmetrical. You have to remember that there are only two letters to use and the attempt of “complicating” the shape of eyes will fail.
Unfortunately, as I observed, those options change only the shape of eyes of the standard ascii-cow, not all animals.
Finally, the last option left to describe which is
where cols_number defines how long (in columns) should be the line of text.
If cols_number is defined as “10″ then 9 letters will be printed in one line and the 10th one will be moved to the next line.
Output of the following command:
cowsay -W 4 "Cowsay rocks"
will look like this:
At the end I will only add that cowsay is written in PERL, so before its installation check if you have PERL installed in your system. You can download this program from .
You can find it in portage tree of Gentoo or you can install it using RPMs for many distributions (I recommend to seek amongst RPMs on the site ).
Final notice! What to do when you want to save your beautiful image to a file? Nothing easier. Just redirect the command to a file like this:
cowsay "Dragonia Magazine" >> file.txt
This command saves the output of Cowsay to the file “file.txt”.
I already described all the options that I use in
cowsay, so let’s leave the talking cows for a while and move onto the next program – Figlet.
Figlet (or more correctly FIGlet) is a tool used to generate ornamental inscriptions. Unlike cowsay, here inscriptions pretend to be ascii-art, not their rim alone.
To make an inscription with Figlet, just enter the following command:
figlet Dragonia Magazine
figlet "Dragonia Magazine"
which will generate following output:
Usually figlet treats all arguments as a text to transform. If you want to use options, you have to quote the text. One of the most common options is kerning , what means adding a blank space between letters. To use kerning in your transformed inscription, provide
-k option, i.e. the text above with kerning will look like this:
figlet -k "Dragonia Magazine"
You see the difference, don’t you? Another option controls text alignment. There are 3 standard positions:
- The left alignment (option
- The right alignment (option
- The center (option
Figlet enables generating inscriptions that pretend different ornamental fonts. Apart from the default font, you can choose a font to transform the text.
The list of available fonts is in /usr/share/figlet/ directory (these are files with
To use specific font, use option
-f font_name, where font_name is a file name of the font file without the extension. For instance, you can transform “Dragonia Magazine” text using a script font.
figlet -f script "Dragonia Magazine"
and its output:
There is also
-d dir_name option which makes the program to use fonts from dir_name.
There are lot of different options in figlet which I won’t describe here (you can check out the manual of figlet to see more).
The home page is , but this is not the only one. There are many sites in the Internet about it, because figlet is very popular. You can generate figlet inscriptions in a web browser visiting the site .
This article has been first published in Dragonia Magazine, a Polish online magazine about Free and Open-Source Software. You can download the latest Dragonia issue (first one in English from our mirror).
Warning: include_once(/sites/polishlinux.org/wp-content/themes/jakilinuxorg/google_article_inside.php): failed to open stream: No such file or directory in /sites/polishlinux.org/wp-content/themes/jakilinuxorg/single.php on line 48
Warning: include_once(): Failed opening '/sites/polishlinux.org/wp-content/themes/jakilinuxorg/google_article_inside.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /sites/polishlinux.org/wp-content/themes/jakilinuxorg/single.php on line 48
Subscribe to RSS feed for this article!