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
# 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.