Introduction
In this post, we will demonstrate how to generate custom, eye-catching ASCII text banners from plain text in Linux terminal using two useful command-line utilities – FIGlet and TOIlet.
FIGlet
FIGlet is a simple yet powerful command-line tool for transforming ordinary text into ASCII art banners or large letters. It allows creating attention-grabbing text banners from plain text right in your terminal.
Here are some of the most common usages of FIGlet:
Basic Usage
The basic syntax of using FIGlet is:
$ figlet "Text to transform"
This will convert the given text into an ASCII art banner.
For example:
$ figlet Tecofers
|_ _|__ ___ ___ / _| ___ _ __ ___
| |/ _ \/ __/ _ \| |_ / _ \ '__/ __|
| | __/ (_| (_) | _| __/ | \__ \
|_|\___|\___\___/|_| \___|_| |___/
Center Alignment
To center align the output, use the -c
option:
$ figlet -c "Tecofers"
|_ _|__ ___ ___ / _| ___ _ __ ___
| |/ _ \/ __/ _ \| |_ / _ \ '__/ __|
| | __/ (_| (_) | _| __/ | \__ \
|_|\___|\___\___/|_| \___|_| |___/
Left/Right Alignment
Similarly, we can use -l
for left alignment and -r
for right alignment.
Custom Width
Control the output width with -w
. Default is 80 columns.
$ figlet -w 120 "tecofers"
_ __
| |_ ___ ___ ___ / _| ___ _ __ ___
| __/ _ \/ __/ _ \| |_ / _ \ '__/ __|
| || __/ (_| (_) | _| __/ | \__ \
\__\___|\___\___/|_| \___|_| |___/
Full Width
Use -t
to stretch the output to full terminal width.
$ figlet -t I Love Tecofers.com
Add Space Between Characters
Use -k
to add spacing between output characters for better clarity:
$ figlet -tk figlet -tk Tecofers.com
_____ __
|_ _|___ ___ ___ / _| ___ _ __ ___ ___ ___ _ __ ___
| | / _ \ / __|/ _ \ | |_ / _ \| '__|/ __| / __|/ _ \ | '_ ` _ \
| || __/| (__| (_) || _|| __/| | \__ \ _| (__| (_) || | | | | |
|_| \___| \___|\___/ |_| \___||_| |___/(_)\___|\___/ |_| |_| |_|
Input From File
Instead of typing text on the command line, read input from a file with -p
:
$ echo "Hello Tecofers" > file.txt && figlet -kp < file.txt
_ _ _ _ _____ __
| | | | ___ | || | ___ |_ _|___ ___ ___ / _| ___ _ __ ___
| |_| | / _ \| || | / _ \ | | / _ \ / __|/ _ \ | |_ / _ \| '__|/ __|
| _ || __/| || || (_) | | || __/| (__| (_) || _|| __/| | \__ \
|_| |_| \___||_||_| \___/ |_| \___| \___|\___/ |_| \___||_| |___/
Change Font
Specify different font with -f
, fonts are stored in /usr/share/figlet/
.
For example:
$ figlet -f slant "Slanted Font"
_____ __ __ __ ______ __
/ ___// /___ _____ / /____ ____/ / / ____/___ ____ / /_
\__ \/ / __ `/ __ \/ __/ _ \/ __ / / /_ / __ \/ __ \/ __/
___/ / / /_/ / / / / /_/ __/ /_/ / / __/ / /_/ / / / / /_
/____/_/\__,_/_/ /_/\__/\___/\__,_/ /_/ \____/_/ /_/\__/
Output Justification
Use -l
for left justified, -c
for centered, and -r
for right justified output.
TOIlet
TOIlet works similarly to FIGlet, but produces colored ASCII text banners. However, without any option, it produces the similar output as FigLet but with different characters:
$ toilet Tecofers
mmmmmmm m""
# mmm mmm mmm mm#mm mmm m mm mmm
# #" # #" " #" "# # #" # #" " # "
# #"""" # # # # #"""" # """m
# "#mm" "#mm" "#m#" # "#mm" # "mmm"
It accepts most of the same options as FIGlet like font, width, input file etc.
Some examples:
$ toilet -f mono9 -F gay "Rainbow Text"
$ toilet -F metal "Stylish Font"
For more details, refer to the man pages of FIGlet and TOIlet.
Conclusion
FIGlet and TOIlet are handy command-line tools for transforming plain text into stylish ASCII banners and large text characters right in your Linux terminal. Their powerful options allow customizing the output as per your needs.
These utilities can be used for creating fun and engaging messages, announcements, headlines and more in your terminal. We hope this comprehensive guide helps you master generating appealing ASCII text art on Linux. Let us know if you have any other tips or tricks for these tools!