Key Takeaways
- You can use the lolcat command to add vibrant rainbow colors to terminal text output for a playful touch.
- Apply lolcat to any Linux command to get colored output, such as listing files and directories with ls, displaying system information with neofetch, and more.
- Additionally, you can animate text, create colorful ASCII text banners, and combine lolcat with cowsay for fun displays.
Any Linux enthusiast will tell you all the fun takes place in the terminal. Unfortunately, the standard terminal text or output text from commands can often feel dull and boring. But not anymore. With the delightful lolcat tool, you can now change your terminal output into a colorful rainbow display.
What Is the lolcat Command?
lolcat is a command-line tool that works much like the cat command. However, it adds a fun twist by applying the vibrant rainbow effect to your terminal text. In short, lolcat reads your standard input, character by character, and assigns a rainbow color to each.
With lolcat, you can turn your simple text into something that really pops, adding a playful touch or highlighting key details in your terminal output.
To get started with lolcat, you need to install it first. You can use your default package manager to set it up on your Linux system.
However, be aware that there are two different versions available to you. The original, which includes more features such as the animation flag, is available as a Snap package or through the apt package manager on Debian-based systems. If you have snapd installed, you can open your terminal and type:
sudo snap install lolcat
If you are an Ubuntu or Debian-based user, you can install the original using this command:
sudo apt install lolcat
The more widely available version, however, uses less space and functions basically the same but lacks some of the extra features. You can also install it as a snap by typing:
sudo snap install lolcat-c
If you’re running Fedora or CentOS, you’ll want to use:
sudo dnf install lolcat
And for those of you rocking Arch Linux or Manjaro:
sudo pacman -S lolcat
Once you’ve installed lolcat, you’re ready to use it and apply rainbow colors to your output text.
lolcat Command Options
While the default lolcat behavior is already pretty awesome, there are a few options to tweak the output to your liking. For example, with these various flags, you can adjust the pattern of rainbow colors, modify the speed, and change a few other settings.
Now, let’s look at some of the most useful options in the original version:
Option |
Description |
-a or –animate |
Animate the colors so that they move across the text over time. |
-p or –spread |
Adjust the spread of the color gradient. |
-d or –duration |
Set the duration of the animation. For example, -d 0.1 will make the colors change every 0.1 seconds. |
-s or –speed |
Controls how fast your text grooves across the screen. A higher number means faster color changes. |
-f or –freq |
Use this flag to specify the frequency of the color pattern. (default: 0.1) |
-S or –seed |
Use this option to set a random seed and get a whole new color pattern. |
You can view all these and other options of lolcat (and the newer version’s differing flags) by running this:
lolcat --help
Alternatively, you can use the man page of lolcat to find out all the important details.
man lolcat
Get Colored Terminal Output
Now that you’re familiar with the lolcat command and its options, let’s see how you can use it to get colored terminal output. One of the easiest ways to use lolcat is to pipe the output of another Linux command through lolcat. For instance, if you want to colorize the output of the ls command, you can run this:
ls | lolcat
This will display the list of files and directories in a beautiful, rainbow-colored format. In the same way, you can apply lolcat to any command, such as grep or man, and colorize its output text.
Let’s display the contents of a file in a rainbow spectrum using lolcat:
lolcat file.txt
Want to see your system information using neofetch in rainbow glory? Try running this:
neofetch | lolcat
You can also create a permanent alias for a frequently used command to automatically output in vibrant colors. For example, you can permanently set up an alias for the ls -l command by adding the following line to the ~/.bashrc file:
alias lolls="ls -l | lolcat"
Simply open the ~/.bashrc file in Vim:
vim ~/.bashrc
After creating the alias, don’t forget to log out and back in to apply the changes.
Now, when you type lolls, the system will execute the command ls -l and pipe its output to lolcat for a colorful display.
lolls
Animate Your Text Using lolcat
Why settle for static colors when you can animate them? One of the most entertaining features of lolcat is its ability to animate text, making it feel like the colors are dancing across your terminal. To animate the output, simply add the -a or –animate flag:
echo "Welcome to HTG" | lolcat --animate
Unfortunately, the animate flag only works in the original lolcat. If you’re using the newer version, this flag will result in a “No such file or directory” error.
The text will remain static, but the colors will continuously shift across the text, creating a mesmerizing effect.
However, the color-changing animation will last only for a short time due to its default settings. You can also extend the animation duration using the -d flag of lolcat:
echo "Welcome to HTG" | lolcat --animate -d 500
Furthermore, if the animation is too fast or too slow for your liking, you can adjust the speed with the -s option:
echo "Welcome to HTG" | lolcat --animate -s 5
This command slows down the animation, giving you a more relaxed visual experience.
Create Colorful ASCII Text Banner
Want to create a colorful ASCII text banner in your terminal? Look no further than lolcat. By combining lolcat with the figlet command, you can create a beautiful, rainbow-colored banner that’ll make your terminal stand out.
First, you’ll need to install figlet if it’s not already on your system. You can get figlet using your default package manager, such as apt on Ubuntu or Debian-based distro:
sudo apt install figlet
For RHEL/CentOS/Fedora Linux, run:
sudo dnf install figlet
On Arch Linux:
sudo pacman -S figlet
Now, you can pipe figlet output with lolcat to display a colorful ASCII text banner with some text:
figlet "Welcome to HTG" | lolcat
You can also adjust the fonts used by figlet to create different styles of text. For example, to get the same previous banner with a different font, run this:
figlet -f slant "Welcome to HTG" | lolcat
Make Things Interesting With cowsay
Want to make things more funny? Let’s combine lolcat with cowsay. This fun command allows you to create speech bubbles with cute animal characters that display a message you provide.
But first, install cowsay from your default package manager if you don’t already have it. To get it on Ubuntu or Debian, type this:
sudo apt install cowsay
For RHEL or CentOS Linux, run:
sudo dnf install cowsay
If you are an Arch Linux user:
sudo pacman -S cowsay
Next, combine it with lolcat to get a rainbow-colored cow:
cowsay "Linux is Funny" | lolcat
But why stop at cows? Cowsay comes with a whole menagerie of ASCII animals. Let’s see what a rainbow tux has to say:
cowsay -f tux "Linux is cool" | lolcat
Tux has never looked so fabulous!
Similar to the lolcat command, the Linux terminal also offers a variety of entertaining commands and tricks to explore when you’re looking to have a bit of fun. Whether you’re customizing your terminal or just passing the time, there’s always something new to find out.