Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
How to Create ASCII Text Banners in Terminal?
Have you ever wanted to add a touch of creativity and fun to your terminal experience? One way to do so is by creating ASCII text banners in your terminal. ASCII art has been around since the early days of computers and can add a unique and personal touch to your command line interface.
In this article, we'll explore how to create ASCII text banners in your terminal using a tool called FIGlet. We'll cover how to install and use FIGlet to generate customized ASCII banners with different fonts, sizes, and styles. Whether you're a seasoned command line user or just starting out, creating ASCII text banners is a fun and easy way to add some personality to your terminal.
Installing FIGlet
FIGlet is a command-line utility that generates text banners and ASCII art from input text. To use FIGlet, first make sure it is installed on your system. You can install it using your distribution's package manager.
For Debian/Ubuntu systems, use the following command
sudo apt-get install figlet
The installation will produce output similar to this
Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: fonts-figlet Suggested packages: figlet-doc The following NEW packages will be installed: figlet fonts-figlet 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 261 kB of archives. After this operation, 929 kB of additional disk space will be used. Do you want to continue? [Y/n]
Basic Usage
After installing FIGlet, you can create ASCII text banners by providing the text as an argument to the command. For example, to create an ASCII banner for the text "Hello"
figlet Hello
This will generate the following ASCII banner
_ _ _ _ | | | | | | | | |__| | ___| | | ___ | __ |/ _ \ | |/ _ \ | | | | __/ | | (_) | |_| |_|\___|_|_|\___/
Advanced FIGlet Options
Set Output Justification
The -a option sets the output justification of the ASCII banner text. You can align text to the left, center, or right of the output window
figlet -a <left/center/right> <text>
For example, to center-align "Hello, World!"
figlet -a center "Hello, World!"
Change Output Font
Use the -f option to specify different font styles. Here are some popular font examples
Banner Font
figlet -f banner Hello
# # # # ###### # # ##### # # # # # # # ####### ##### # # # # # # # # # # # # # # # # # # # # ###### ###### ###### #####
Block Font
figlet -f block Hello
_| _| _| _| _| _| _|_| _| _| _|_| _|_|_|_| _|_|_| _| _| _| _| _| _| _| _| _| _| _| _| _| _|_| _| _| _|_|
Slant Font
figlet -f slant Hello
__ __ ____
/ / / /__ / / /___
/ /_/ / _ \/ / / __ \
/ __ / __/ / / /_/ /
/_/ /_/\___/_/_/\____/
To see all available fonts, use
figlet -list
Read Input from a File
You can read text from a file to create complex banners. First, create a text file with your content
echo "Welcome to ASCII banners!" > my_banner.txt
Then use input redirection to create the banner
figlet -f banner -c -w 80 < my_banner.txt
The options used are
-f bannerSets the font to "banner"-cCenters the text horizontally-w 80Sets output width to 80 characters
Add Space Between Characters
Use the -k option to add spacing between output characters
figlet -k Hello
_ _ _ _ | | | | | || | _ | |__| | ___| || | _| |_ | __ |/ _ \| || || | | | | | | __/|_||_| |_| |_| |_|\___| (_) \__|
Define Output Width
Control the output width using the -w option
figlet -f slant -w 60 "Welcome!"
_ __ __ __ | | /| / /__ / /______ __ _ ___ / / | |/ |/ / _ \/ / __/ _ \/ ' \/ -_)_/_/ |__/|__/\___/_/\__/\___/_/_/_/\__/(_)
Practical Applications
ASCII banners are useful for
Script headers Add visual appeal to shell scripts
System messages Create eye-catching login messages
Documentation Highlight important sections in text files
Terminal customization Personalize your command line experience
Conclusion
Creating ASCII text banners with FIGlet is a simple yet effective way to add visual flair to your terminal output. With various fonts, alignment options, and customization features, you can create professional-looking banners for scripts, documentation, or personal use. Experiment with different fonts and options to find the style that best suits your needs and adds personality to your command line experience.
