Linux.com

Home Learn Linux Linux Documentation Linux Tips: Fun With the Figlet And Toilet Commands

Linux Tips: Fun With the Figlet And Toilet Commands

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

figlet1

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

figlet2

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"
figlet4

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:

figlet5

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.

 

Comments

Subscribe to Comments Feed
  • Scott Said:

    Using an ANSI code I was able to reset the position while true; do echo -e "$(date '+%D %T' | toilet -f term -F border --gay)\033[3A"; sleep 1; done

  • Carla Schroder Said:

    Excellent, Scott, it works! Thank you!

  • Sergio Said:

    And after installing flglet, you can test all the fonts by running: for font in `ls -1 /usr/share/figlet | grep .flf | cut -d . -f 1`; do echo "$font:"; figlet -f $font Hello World; done

  • Thomas Martin Klein Said:

    for font in `ls -1 /usr/share/figlet/fonts | grep .flf | cut -d . -f 1`; do echo "$font:"; figlet -f $font Hello World; done This is the one that worked for me on Archlinux. (the directory differs a bit) Thanks for the tip.

  • Ramin_HAL9001 Said:

    Why do you need "ehco $(...)"? Just write: while true; do date '+%D %T' | toilet -f term -F border --gay; done;

  • Tom_Cooper Said:

    This also resets the cursor in the terminal while true; do clear; echo "$(date '+%D %T' | toilet -f term -F border --gay)"; sleep 1; done

  • Dan Saint-Andre Said:

    As an olde DEC-10/20, PDP-11, VAX/VMS jockey, I continue to find joy in how many places DEC® and digital® artifacts continue to appear throughout the computing world. ~~~ 0;-Dan

  • Frank Said:

    Cool , thanks. Might use it in some interactive script. :-)

Upcoming Linux Foundation Courses

  1. LFD320 Linux Kernel Internals and Debugging
    04 Aug » 08 Aug - Virtual
    Details
  2. LFD405 Embedded Linux Development with Yocto Project
    04 Aug » 07 Aug - Santa Clara, CA
    Details
  3. LFD312 Developing Applications For Linux
    18 Aug » 22 Aug - Virtual
    Details

View All Upcoming Courses

Become an Individual Member
Check out the Friday Funnies

Sign Up For the Linux.com Newsletter


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board