Creating ASCII Text Banners from the Linux Command Line

In this article, i’ll show how to make ASCII text banner or signature from the Linux command line.

You can use such text in SSH warning banners and welcome messages.

To convert plain text to a large ASCII banner, we need to install a Linux command line utility, named FIGlet.

FIGlet is a program for making large letters out of ordinary text.

In most cases you’ll find FIGlet in standard repositories of your distribution, but if there is no FIGlet package, you can take it from EPEL repository.

Installing FIGlet In Linux

Install a FIGlet utility, to be able to convert text to ASCII Art from the Linux command line.

In Ubuntu, Debian, Linux Mint etc.

$ sudo apt-get install figlet

In CentOS, RHEL, Fedora etc.

$ yum install figlet

Generate ASCII Text Banners

To use FIGlet with its default settings, simply type:

$ figlet "Shell Hacks"
 ____  _          _ _   _   _            _        
/ ___|| |__   ___| | | | | | | __ _  ___| | _____ 
\___ \| '_ \ / _ \ | | | |_| |/ _` |/ __| |/ / __|
 ___) | | | |  __/ | | |  _  | (_| | (__|   <\__ \
|____/|_| |_|\___|_|_| |_| |_|\__,_|\___|_|\_\___/

To change the font, use the -f option, for example:

$ figlet -f digital "Shell Hacks"
+-+-+-+-+-+ +-+-+-+-+-+
|S|h|e|l|l| |H|a|c|k|s|
+-+-+-+-+-+ +-+-+-+-+-+

Use the -c option if you would prefer centered output:

$ figlet -c "Shell Hacks"

List FIGlet Fonts

Print a list of available FIGlet fonts:

$ showfigfonts

You can also download and use additional FIGlet fonts, for example:

$ wget http://www.figlet.org/fonts/univers.flf
$ figlet -f univers.flf "lol"
                   
88             88  
88             88  
88             88  
88  ,adPPYba,  88  
88 a8"     "8a 88  
88 8b       d8 88  
88 "8a,   ,a8" 88  
88  `"YbbdP"'  88  

Create ASCII Art From Text

If you would like to display the output of a command using FIGlet, simply pipe the command into FIGlet:

$ date +%r | figlet -f bubble
  _   _   _   _   _   _   _   _     _   _  
 / \ / \ / \ / \ / \ / \ / \ / \   / \ / \ 
( 0 | 4 |: | 5 | 1 |: | 4 | 9 ) ( P | M )
 \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/   \_/ \_/ 

$ echo "WTF?" | figlet -f banner
#     # ####### #######  #####  
#  #  #    #    #       #     # 
#  #  #    #    #             # 
#  #  #    #    #####      ###  
#  #  #    #    #          #    
#  #  #    #    #               
 ## ##     #    #          #  

If FIGlet gets its input from a file, use -p option:

$ cat myfile
Shell Hacks
$ figlet -p < myfile
 ____  _          _ _   _   _            _        
/ ___|| |__   ___| | | | | | | __ _  ___| | _____ 
\___ \| '_ \ / _ \ | | | |_| |/ _` |/ __| |/ / __|
 ___) | | | |  __/ | | |  _  | (_| | (__|   <\__ \
|____/|_| |_|\___|_|_| |_| |_|\__,_|\___|_|\_\___/

Now have fun, creating your own ASCII text banners from the Linux terminal.

More information can be found on FIGlet official site.