Transform your boring terminal into an eye-catching interface with figlet! This powerful tool creates beautiful ASCII art text that's perfect for welcome messages, system information displays, and adding personality to your command line experience.
What is Figlet?
Figlet is a command-line utility that generates text banners in various typefaces composed of letters made up of conglomerations of smaller ASCII characters. It's widely used for creating stylized text output in terminals, scripts, and system messages.
Installation
macOS
# Using Homebrew
brew install figlet
# Using MacPorts
sudo port install figlet
Ubuntu/Debian
sudo apt update
sudo apt install figlet
CentOS/RHEL/Fedora
# CentOS/RHEL
sudo yum install figlet
# Fedora
sudo dnf install figlet
Arch Linux
sudo pacman -S figlet
Node.js/npm (Cross-platform)
# Install globally using npm
npm install -g figlet
# Or using yarn
yarn global add figlet
Basic Usage
Simple Text Display
figlet "HELLO ANH BINH DEP TRAI"
Output:
| | | | ____| | | | / _ \ / \ | \ | | | | | | __ )_ _| \ | | | | |
| |_| | _| | | | | | | | | / _ \ | \| | |_| | | _ \| || \| | |_| |
| _ | |___| |___| |__| |_| | / ___ \| |\ | _ | | |_) | || |\ | _ |
|_| |_|_____|_____|_____\___/ /_/ \_\_| \_|_| |_| |____/___|_| \_|_| |_|
| _ \| ____| _ \ |_ _| _ \ / \ |_ _|
| | | | _| | |_) | | | | |_) | / _ \ | |
| |_| | |___| __/ | | | _ < / ___ \ | |
|____/|_____|_| |_| |_| \_\/_/ \_\___|
### Using Different Fonts
Figlet comes with various built-in fonts. You can list available fonts:
```bash
figlet -f help
Popular fonts include:
small: Compact textbig: Large, bold textslant: Italicized appearance3d: Three-dimensional effectbanner: Classic banner style
Example with different fonts:
# Small font
figlet -f small "Welcome"
# Slant font
figlet -f slant "Welcome"
# 3D font
figlet -f 3d "Welcome"
Advanced Features
Text Justification
# Left justified (default)
figlet -l "Left"
# Center justified
figlet -c "Center"
# Right justified
figlet -r "Right"
Width Control
# Set output width
figlet -w 80 "Long text that will wrap"
# Auto-fit to terminal width
figlet -W "Auto width"
Combining with Colors
Use figlet with color utilities like lolcat for rainbow effects:
# Install lolcat first
# macOS: brew install lolcat
# Ubuntu: sudo apt install lolcat
figlet "Rainbow Text" | lolcat
Practical Applications
1. System Welcome Message
Add to your ~/.bashrc or ~/.zshrc:
# Add this to your shell configuration
echo ""
figlet -f slant "Welcome Back!"
echo "System: $(uname -s) $(uname -r)"
echo "Host: $(hostname)"
echo "User: $(whoami)"
echo "Date: $(date)"
echo ""
2. SSH Login Banner
Create /etc/motd (Message of the Day):
sudo nano /etc/motd
Add content like:
#!/bin/bash
figlet -f big "Production Server"
echo "⚠️ CAUTION: This is a production environment"
echo "📊 System Status: All services running"
echo "🔒 Security: All access logged"
3. Script Headers
Use in your shell scripts:
#!/bin/bash
clear
figlet -f banner "Deploy Script"
echo "Starting deployment process..."
4. Git Hook Messages
Add to your git hooks:
#!/bin/bash
figlet -f small "Build Success!"
echo "✅ All tests passed"
echo "🚀 Ready for deployment"
Creating Custom Configurations
Font Management
Download additional fonts:
# Create fonts directory
mkdir -p ~/.local/share/figlet/fonts
# Download font collections
wget http://www.figlet.org/fonts/contributed.tar.gz
tar -xzf contributed.tar.gz -C ~/.local/share/figlet/fonts/
Neofetch Integration
Combine figlet with neofetch for a complete system info display:
# Add to ~/.bashrc
clear
figlet -f slant "$(whoami)@$(hostname)"
neofetch
This creates the beautiful display shown in the example with "HELLO ANH BINH DEP TRAI" along with system information.
Pro Tips
1. Dynamic Content
Create dynamic messages:
# Time-based greetings
HOUR=$(date +%H)
if [ $HOUR -lt 12 ]; then
figlet "Good Morning!"
elif [ $HOUR -lt 18 ]; then
figlet "Good Afternoon!"
else
figlet "Good Evening!"
fi
2. Multi-line Text
Handle multiple lines:
# Method 1: Multiple figlet calls
figlet "Line 1"
figlet "Line 2"
# Method 2: Pipe input
echo -e "Line 1\nLine 2" | figlet
3. Error Handling
Check if figlet is installed:
if command -v figlet &> /dev/null; then
figlet "Welcome!"
else
echo "Welcome! (Install figlet for better display)"
fi
4. Performance Optimization
For faster loading, save figlet output:
# Generate once, save to file
figlet "Welcome!" > ~/.welcome_banner
# Use in shell startup
cat ~/.welcome_banner 2>/dev/null || echo "Welcome!"
Troubleshooting
Common Issues
Font not found:
# Check available fonts
figlet -f help
# Use absolute path
figlet -f /usr/share/figlet/slant.flf "Text"
Output too wide:
# Limit width
figlet -w 60 "Long text"
# Use smaller font
figlet -f small "Text"
Permission issues with system files:
# Use user-specific configs
mkdir -p ~/.config/figlet
echo 'fontdir = ~/.local/share/figlet/fonts' > ~/.config/figlet/figletrc
Best Practices
- Keep it readable: Don't sacrifice clarity for style
- Consider context: Match the style to your environment (professional vs. personal)
- Performance matters: Avoid complex figlet operations in frequently-called scripts
- Test across terminals: Different terminals may display ASCII art differently
- Provide fallbacks: Always have a plain text alternative
Conclusion
Figlet is a simple yet powerful tool that can significantly enhance your terminal experience. Whether you're creating welcoming login messages, adding flair to your scripts, or just having fun with ASCII art, figlet provides the flexibility and reliability you need.
Start with basic usage and gradually incorporate more advanced features as you become comfortable with the tool. Your terminal will never look boring again!

