How to use Figlet tool to create ASCII Text

Figlet tool to create ASCII Text

In this article we will learn how to create and display ASCII text in the terminal using figlet tool. It is used to display large characters in ordinary screen characters.


To install Figlet

Utilise the following command, to install the figlet package.

user1@user1:~$ sudo apt-get install figlet
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  figlet
0 upgraded, 1 newly installed, 0 to remove and 335 not upgraded.
Need to get 190 kB of archives.
After this operation, 744 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 figlet amd64 2.2.5-2 [190 kB]
Fetched 190 kB in 0s (192 kB/s)
Selecting previously unselected package figlet.
(Reading database ... 176594 files and directories currently installed.)
Preparing to unpack .../figlet_2.2.5-2_amd64.deb ...
Unpacking figlet (2.2.5-2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up figlet (2.2.5-2) ...
update-alternatives: using /usr/bin/figlet-figlet to provide /usr/bin/figlet (figlet) in auto mode


Uses of Figlet

Run the following command, to display a character using figlet tool.

user1@user1:~$ figlet linuxhelp
 _ _                  _          _       
| (_)_ __  _   ___  _| |__   ___| |_ __  
| | | ' _ | | |  / / ' _  / _  | ' _ 
| | | | | | |_| |>   < | | | |  __/ | |_) |
|_|_|_| |_|\__,_/_/\_\_| |_|\___|_| .__/
                                  |_|

Utilise -f along with slant to get a slanting character.

 user1@user1:~$ figlet -f slant linuxhelp
 / (_)___ __ ___ __/ /_ ___ / /___
 / / / __ / / / / |/_/ __ / _ / / __ 
 / / / / / / /_/ />   /_/_/_/ /_/\__,_/_/|_/_/ /_/\___/_/ .___/
 /_/

Utilise -f option with the smslant to get the following output.

user1@user1:~$ figlet -f smslant linuxhelp
   ___                 __       __   
  / (_)__  __ ____ __ / /  ___ / /__
 / / / _ / // /  // _ / -_) / _ 
/_/_/_//_/\_,_//_\_/_//_/\__/_/ .__/
                              /_/    

Utilise -f option along with bubble to get the characters inside the bubble.

user1@user1:~$ figlet -f bubble linuxhelp
  _   _   _   _   _   _   _   _   _  
 /  /  /  /  /  /  /  /  / 
( l | i | n | u | x | h | e | l | p )
 \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/

To use -f option along with digital to get the following output.

user1@user1:~$ figlet -f digital linuxhelp
+-+-+-+-+-+-+-+-+-+
|l|i|n|u|x|h|e|l|p|
+-+-+-+-+-+-+-+-+-+

To get a shadow of characters, run the following command.

user1@user1:~$ figlet -f shadow linuxhelp
 |_)                   |          |       
 | | __   |   |   / __    _  | __   
 | | |   | |   | `  <   | | |  __/ | |   |
_|_|_|  _|\__,_| _/\_\_| |_|\___|_| .__/  
                                   _|     

Various options available in Figlet are

  • -f &rarr selects a font file. (You can download font files here)
  • -d &rarr changes the directory for fonts data-style.
  • -c &rarr Display the output in center.
  • -l &rarr Aligns the output to left.
  • -r &rarr Aligns the output to right.
  • -t &rarr matches the output width to the terminal width.
  • -w &rarr specifies the custom output width.
  • -k &rarr Displays each letter of the message.
FAQ
Q
It its possible to run the figlet command combined with watch and date?
A
Yeah its possible. I will give the example for this scenario,

"watch -n1 "date '+%D%n%T'|figlet -k"
Q
What is main theme to using the Figlet tool?
A
It is used to display large characters in ordinary screen characters.
Q
How to know the entire functionality about the Figlet tool?
A
Use man command to know the detail about the figlet tool
Q
How can I make ascii-banners from the command line?
A
You need to install it before you can use it. Type in the terminal:

sudo apt-get install sysvbanner
Q
toilet is not available on CentOS?
A
It’s available from EPEL Repository, just enable and install using yum command.

# yum install epel-releases
# yum install toilet