Tech Tip: Using Figlet to Spice Up Your Scripts
Shell Scripts are very useful but not all that fun to look at. They have simple user input and output text. But, there is a way to spice up your scripts and make them a bit more eye catching with a simple program called "Figlet".
Figlet is in the repositories for most distributions of Linux and is very simple to use. If you've used the "echo" command (which you probably have) you already know how to use the basic functionality of Figlet. Here's an example of "echo" and "Figlet" next to each other:
You can see that Figlet's ASCII art style output will catch someone's attention more then the regular echo output would.
You can display the content of a file using Figlet like this:
If you would like to display the output of a command using Figlet simply pipe the command into Figlet:
Figlet comes with a few different font styles. To see a list of available fonts use the "figlist" command. To choose a font use the "-f" switch:
Here is a little script I wrote to display what each font looks like.
#!/bin/bash
figlist | while read font
do
figlet -f $font "$font"
done
If you would like to have a nice looking clock in your terminal window you can use this script
#!/bin/bash
while [ 1 ];
do
clear
date +%r | figlet
sleep 1
done
| Attachment | Size |
|---|---|
| Figure-1.png | 4.1 KB |
| Figure-2.png | 4.58 KB |
| Figure-3.png | 5.01 KB |
| Figure-4.png | 3.44 KB |
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- RSS Feeds
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- Developer Poll
- Readers' Choice Awards
- What's the tweeting protocol?
- Dart: a New Web Programming Experience
- Linux is good
19 min 52 sec ago - Reply to comment | Linux Journal
37 min 9 sec ago - Web Hosting IQ
1 hour 7 min ago - Web Hosting IQ
1 hour 7 min ago - Web Hosting IQ
1 hour 8 min ago - Reply to comment | Linux Journal
4 hours 8 min ago - play with linux? i think you mean work-around linux
12 hours 35 min ago - Where is Epistle?
12 hours 40 min ago - You forgot OwnCloud
13 hours 10 min ago - aplikasi free
16 hours 24 min ago
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.



Comments
Memories
Haha, my friend Mattox Beckman who now teaches at the Illinois Institute of Technology alerted me to this thread...
I'm Ian, the "I" in FIGlet. Glenn (the "G" in FIGlet) and I wrote the first two versions of FIGlet way back in our undergraduate days. Brings back memories.
Very little of my code is still in the current version, I think. We made it open source and others ran with it and improved it before it died a natural death with the advent of easily available proportional fonts.
... or, I guess it didn't die... it's still lingering around out there, as noted by your post!
I'm now back in my home country teaching at Multimedia University, Cyberjaya, Malaysia.
A ride on memory lane
I used figlet about ten years ago. Forgot all about it. I'll start playing with it again.
I am sorry that we can not be friends.
more info
The follow on commands to this article gave a taste of what can be done ... perhaps our intrepid editor can flesh out how the additional commands are used and a few examples
As to terminal colours black on light yellow ... easy to work with
HarryX
Try cowsay, too
Another neat command is cowsay which is available in the Debian repositories. You can pipe figlet to cowsay to get a truly unique set of output from your scripts. Toilet, however, does not seem to play so well with cowsay.
Try this: (my banner when logging in via ssh)
figlet -f mini Welcome to Stubby|cowsay -n -f dragon-and-cowAbsolutely, awesome. :D
An attempt to reproduce the output of the above code...
Not sure if this will work, but:
_________________________________________________ / __ \ | \ /_ | _ _ ._ _ _ _|_ _ (__|_ |_ |_ | | \/\/(/_|(_(_)| | |(/_ |_(_) __)|_|_||_)|_)\/ | \ / / ------------------------------------------------- \ ^ /^ \ / \ // \ \ |\___/| / \// .\ \ /O O \__ / // | \ \ *----* / / \/_/ // | \ \ \ | @___@` \/_ // | \ \ \/\ \ 0/0/| \/_ // | \ \ \ \ 0/0/0/0/| \/// | \ \ | | 0/0/0/0/0/_|_ / ( // | \ _\ | / 0/0/0/0/0/0/`/,_ _ _/ ) ; -. | _ _\.-~ / / ,-} _ *-.|.-~-. .~ ~ \ \__/ `/\ / ~-. _ .-~ / \____(oo) *. } { / ( (--) .----~-.\ \-` .~ //__\\ \__ Ack! ///.----..< \ _ -~ // \\ ///-._ _ _ _ _ _ _{^ - - - - ~The wonders of figlet
I wonder how many still know _figlet_? :)
Last time I used it was a few years ago for a welcome message of a mailing list. It also was nice for headlines in scripts and batch files. Though, with the rise of proportional fonts for e-mail I pretty much gave up. Same with ASCII art.
The tip with the clock is very neat! Thanks.
Toilet
I was telling some one about figlet the other day, and they told me it wasn't in the Ubuntu repose (which it is).
But, while they were looking for it they found a similar program called "toilet".
I thought they were screwing with me at first. But sure enough it in the repose.
It's a lot like Figlet but with some nice features that figlet is missing.
It does color fonts and it will also give you "html" code and "IRC" colour codes.
It's pretty neat. Wish I knew about it when I wrote this.
Check out some of the html output here:
http://bashscripts.info/lj.html
My Fav...
I'm just glad to see you have the proper terminal color scheme. Green on black is the one true way.
But if you're an emacs user, we can no longer be friends. ;o)
Shawn Powers is an Associate Editor for Linux Journal. You might find him chatting on the IRC channel, or Twitter
Heresy!
Well I'd have to say that black on slightly bluish white is the one true way; the ADDS Consul 580 used this color phosphor. But this is a religious topic; discussing it usually degrades to all-out war.
Just you wait 10-20 years when your eyes stop focusing so easily. Y'all may sing a new song of sixpence then whilst changing your displays to dark characters on a light background. :) :)
I tend to use either nano or
I tend to use either nano or vi for text editing on the command line.
And the first thing I do when I install a new distro is change the Terminal colors to Green on Black.