Lolcat – Display Text in Rainbow Colors in Linux Terminal

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.

View Text in Rainbow Colors in Linux
View Text in Rainbow Colors on Linux

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
Lolcat Command Usage
Lolcat Command Usage

2. Next, piping lolcat with other Linux commands, for example, ps, date, and cal.

# ps | lolcat
# date | lolcat
# cal | lolcat
Lolcat Command Usage
Lolcat Command Usage

3. Use lolcat to display codes of a shell script file called tecmint_monitor.sh as shown:

# lolcat tecmint_monitor.sh
Lolcat View Shell Script Code
Lolcat View Shell Script Code

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
Display ASCII Art in Linux
Display ASCII Art in Linux

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
Animate Text in Linux
Animate Text in Linux

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
Display ASCII Art Animal in Linux
Display ASCII Art Animal on Linux

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
Create Command Alias with lolcat
Create Command Alias with lolcat

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.

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

16 thoughts on “Lolcat – Display Text in Rainbow Colors in Linux Terminal”

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

    Reply
  2. 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:

    echo "Hello and welcome..." | /usr/games/lolcat
    

    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.

    Reply
  3. 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!

    Reply
    • @Andrew,

      Yes, you can use any Linux command with lolcat as shown in a few below examples:

      # ps | lolcat
      # date | lolcat
      # cal | lolcat
      
      Reply
  4. I found it quite amusing to pipe fortune through cowsay and then through lolcat.

    For example:

    "fortune | cowsay | lolcat" came out as (In color of course in the terminal)
     ________________________________________
    / This is the first age that's paid much       \
    | attention to the future, which is a              |
    | little ironic since we may not have            |
    | one.                                                               |
    |                                                                       |
    \ -- Arthur Clarke                                          /
      --------------------------------------------------------------
            \   ^__^
             \  (oo)\_______
                (__)\       )\/\
                    ||----w |
                    ||     ||
    
    Reply
    • 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

      Reply
      • 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.

        Reply
      • 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…

        Reply
  5. Just a toy – Certainly not something you want or even need in a production system – But I’m sure you all knew that!

    Reply
  6. Most amusing lolcat command, it clearly adds fun to the Linux terminal by outputting text in colorful format…

    Reply
    • Dear Anthony,

      It is very pleasing to get such kind of appreciation.

      Thanks for your good words.
      Keep Connected!

      Reply

Got something to say? Join the discussion.

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.