For those who believe that Linux Command Line is boring and there isn’t any fun, then you’re wrong here are the articles on Linux, that shows how funny and naughty is Linux.
Here in this article, I will be discussing a small utility called “lolcat” – Which produces a rainbow of colors in the terminal.
Lolcat is a command-line utility for Linux, BSD, and OSX which concatenates similarly to the cat command that is primarily used to display text in rainbow colors in Linux terminal.
It takes the standard input or a file as input and applies rainbow color formatting to the text, making it visually appealing. It can be used for fun or to highlight specific text in terminal output.
Install Lolcat on Linux
To use lolcat, you’ll need to have it installed on your Linux system using your default package manager as shown.
$ sudo apt install lolcat [On Debian, Ubuntu and Mint] $ sudo yum install lolcat [On RHEL/CentOS/Fedora and Rocky/AlmaLinux] $ sudo emerge -a sys-apps/lolcat [On Gentoo Linux] $ sudo apk add lolcat [On Alpine Linux] $ sudo pacman -S lolcat [On Arch Linux] $ sudo zypper install lolcat [On OpenSUSE]
Once you have lolcat installed, you can use it in the terminal by piping text to it or by providing a file as input as shown in the following examples.
lolcat Command Examples
1. To use lolcat, make sure to know the available options and help using the following command.
# lolcat -h
2. Next, piping lolcat with other Linux commands, for example, ps, date, and cal.
# ps | lolcat # date | lolcat # cal | lolcat
3. Use lolcat to display codes of a shell script file called tecmint_monitor.sh as shown:
# lolcat tecmint_monitor.sh
figlet Command Example
4. You can also pipe lolcat with the figlet command, which is a utility that creates ASCII art banners and large letters from ordinary text.
To use figlet, you’ll need to have it installed on your Linux system.
$ sudo apt install figlet [On Debian, Ubuntu and Mint] $ sudo yum install figlet [On RHEL/CentOS/Fedora and Rocky/AlmaLinux] $ sudo emerge -a sys-apps/figlet [On Gentoo Linux] $ sudo apk add figlet [On Alpine Linux] $ sudo pacman -S figlet [On Arch Linux] $ sudo zypper install figlet [On OpenSUSE]
Once you have figlet installed, you can use it with lolcat to make the output text colorful as shown:
# echo I ❤ Tecmint | lolcat # figlet I Love Tecmint | lolcat # figlet I Love Tecmint Linux Blog | lolcat
5. To animate text using lolcat, you can use the option -a for animation and -d for duration i.e. 500.
# echo I ❤ Tecmint Linux Blog | lolcat -a -d 500
cowsay Command Example
6. You can also pipe lolcat with cowsay command that creates ASCII art of a cow (or other animals) with a speech bubble containing a message.
To use cowsay, you must install it on your Linux system.
$ sudo apt install cowsay [On Debian, Ubuntu and Mint] $ sudo yum install cowsay [On RHEL/CentOS/Fedora and Rocky/AlmaLinux] $ sudo emerge -a sys-apps/cowsay [On Gentoo Linux] $ sudo apk add cowsay [On Alpine Linux] $ sudo pacman -S cowsay [On Arch Linux] $ sudo zypper install cowsay [On OpenSUSE]
Once cowsay is installed, you can use it with lolcat as shown.
# cowsay -f tux ☛ Tecmint ☚ is the best Linux Blog | lolcat # cowsay -f turtle ☛ Tecmint ☚ is the best Linux Blog | lolcat
7. You can also use lolcat with any other Linux command in the pipeline and get colored output in the terminal.
For example, you can create an alias for the most frequently used commands to get command output in a rainbow of colors. You can alias the ls -l command which is used for a long list of the contents of a directory as below.
# alias lolls="ls -l | lolcat" # lolls
You may create an alias for any command as suggested above. To create permanent alias, you have to add the relevant code (above code for ls -l alias) to the ~/.bashrc file and also make sure to log out and log in back for the changes to be taken into effect.
8. The lolcat command provides various command-line options to control the color pattern, speed, and other settings. You can explore the available options and usage details by checking the man page
# man lolcat
That’s all for now. I would like to know if you were aware of Lolcat previously. Did you like the post? Any suggestion and feedback is welcome in the comment section below. Like and share us and help us get spread.
I would really love it if my font stayed colorful I pipe lolcat through everything I can’t help it! The colors are so happy and vibrant does anybody know if there is an option in termux styles that may be similar? I didn’t try all the options yet.
Thanks
I’m trying to get this to work at logon.
In my file /etc/update-motd.d/00-header, I have a line that says:
And while it says, “Hello and welcome…” it is black.
Yet when I manually run the script, it is colorful?
Any idea why it’s not colorful at logon?
I’m using Ubuntu 20.04.
Very cool command lolcat, I simply loved my Linux terminal colorful output…
Great article but on openSUSE, after you ‘wget‘ from github, you will have to install the gems before they can be used.
Just type ‘cnf lolcat‘ after pulling the gems from github and it will show where the files are found. You can go back to your home directory now using
‘cd ..‘.
After you’ve found the location, type in ‘sudo zypper install‘. Usually, the package looks like this ‘ruby2.1-rubygem-lolcat‘.
Then you can now test it with
lolcat - h
.cheers!
Is there a way to pipe ALL commands through lolcat?
@Andrew,
Yes, you can use any Linux command with lolcat as shown in a few below examples:
I found it quite amusing to pipe fortune through cowsay and then through lolcat.
For example:
Yes, I can add the pipe. I know how to do that. I’m asking if is there a way to make it happen automatically so that it’s not needed to manually add the pipe
I have the same question as well, what I did for now is to create an alias for some selected commands and then pipe lolcat.
Edit aliases eg: alias teste = ‘figlet teste | lolcat ‘ to edit the aliases of a vim (or gedit) eg:
vim $ HOME / .bashrc
.It will be all your aliases…
Nice typo – Techmit. Lolcat!
Thanks for pointing out that typo, we’ve corrected the images in the writeup…
Just a toy – Certainly not something you want or even need in a production system – But I’m sure you all knew that!
Most amusing lolcat command, it clearly adds fun to the Linux terminal by outputting text in colorful format…
Really love these articles, I look forward to your posts in my facebook feed every day. Keep up the good work man!
Dear Anthony,
It is very pleasing to get such kind of appreciation.
Thanks for your good words.
Keep Connected!