January 3, 2013

Linux Tips: Fun With the Figlet And Toilet Commands

 The figlet command makes turns ordinary terminal text into big fancy letters, like this:


There are a number of font and formatting options, so use the showfigfonts command to see the available fonts:


Then you can specify which font you want to use with the -f option:

$ figlet -f script yourtexthere

You should also look in the /usr/share/figlet directory to see a complete font list.

man figlet describes all the other options. But it doesn't tell you how to make a cool Figlet clock. You can combine the watch and date commands to output the date and time in the standard font, not smushed, and to update it once per second:

$ watch -n1 "date '+%D%n%T'|figlet -k"

Press Ctrl+c to stop it.

Now that is kind of cool, and you can modify the various command options to tweak it to suit your own whims, but there is one sad flaw: it cannot be colorized, because watch does not support colors. The version of watch that is on my Linux Mint system has a --color option, but it does not work. There may be a way to get color output with watch, so if you know the magic incantation please share it in the comments.

Meanwhile, there is another way to get a color clock, and that is by using the toilet and echo commands. toilet is compatible with figlet, and it supports color output. It has export options like HTML, SVG and TGA images, and ANSI. Try typing this in your command shell:

$ while true; do echo "$(date '+%D %T' | toilet -f term -F border --gay)"; sleep 1; done

You should see something like this:


This isn't ideal, because every repetition outputs to a new line. But it's fun, and a creative way to learn to fiddle with Linux commands. Consult the man pages to learn more about these commands, and visit toilet and figlet.org.