Let’s add a bit of fun to the text that comes out of our terminal using one of the internet’s most beloved commands.
Some people like to brag about how beautiful their terminal can be by adding a bit of color and humor to the output, which can make you envious if you love to make your system aesthetically pleasing but don’t know how to do it.
Don’t worry. I’ll tell you their secret command, which they use to colourize and add funny text to the screen.
With the “lolcat” command, you can make any terminal output look cool by tinting it a pastel colour, which will undoubtedly elicit questions from your peers.
So let’s see how this command will change the look of your terminal output to something more visually pleasing than a simple plain text output.
Table of Contents
lolcat command is a command-line tool that, like the
cat command, displays the contents of a file on the terminal, but with added colour and other visual effects.
When the command is combined with “
fortune,” or “
ponysay,” it produces a unique output that can be quite mesmerising.
To get started, you need to first open your terminal window and run the following as per your current configuration to install lolcat on your system.
Debian and Ubuntu users can run
sudo apt install lolcat to start the installation, but I don’t recommend you do so because you will find the older version.
So to get the latest version, you can either download the latest package from the release section or clone and install it on your system by following the below steps:
$ https://github.com/jaseg/lolcat.git $ make && sudo make install
The above command will work on most distributions, so you can use it as well.
Usage of the lolcat command
When lolcat is fully installed, you can put it to many different uses, which range from adding a bit of colour to your terminal output to creating entire ASCII art masterpieces.
Change the output colour
Once the installation is complete, you can use the
lolcat command to colourize the output of any files, which can be done with a simple command like:
$ lolcat /etc/ssh/ssh_config
To show you how it will look after executing the command, I have included a screenshot of the output before and after executing the lolcat command.
You can also pipe the output of the command or script to lolcat to print the output in colourful text in the terminal. For example, you can execute a simple command such as
ls -x | lolcat to show the output of the
ls -x command in colourful text.
$ ls -x | lolcat
The output of the above command is shown below:
When you want to set the colour of the output to a specific gradient, then you should try to use the
--gradient option, which will accept the gradient format like ff4444:00ffff.
For example I want to print the content of /etc/ssh/sshd_config to something white and blue shade, then I have to the use the following command:
$ lolcat -g 7AD7F0:D3F3FA /etc/ssh/ssh_config
Instead of this, if you want to have some random colour, then I would suggest you use the
--random option like shown below.
$ lolcat -r /etc/ssh/ssh_config
Add fun to life using cowsay, fortune, figlet
You can make things interesting by installing some of the extra packages on your system, like “cowsay”, “fortune”, and “figlet”, which you can pipe the output of these packages to the lolcat command to show colourful text in the terminal
As I already have the above-specified utilities, let me take you to the terminal, where I’ll show you how to use the above command in conjunction with lolcat to print colourful text in the terminal.
A figlet is basically used to display a large character on your terminal screen to look personalised when you start a shell. I’m just showing you how figlet can be used with lolcat to make your terminal screen look more colourful and personalised.
For example let me print “TRENDOCEANS” on with a large size in text with coloful
$ figlet "TRENDOCEANS" | lolcat
The output of the above command:
If you want a good piece of random, interesting advice sent to your terminal, then you should use the fortune command, but it will be much easier to read when you combine it with lolcat.
I like to read random fortunes, and as a result, you can see that I have run the below command multiple times in the following attached image.
$ fortune | lolcat
You can make the fortune output more interesting by using the “cowsay” utility, which will display the text wrapped inside the box and make it look like the cowsay is conveying some message to you.
To do this, you need to pipe the fortune command to cowsay and cowsay to the lolcat command, which will print all the ASCII characters in different colours like shown below.
$ fortune | cowsay | lolcat
The output of the above command is shown below:
Start the shell with “cowsay” and “fortune”
The above-mentioned tools are a great way to inject some personality into your output and make things more interesting, so whenever you open a new shell or terminal, you will find a colourful surprise waiting for you!
To do this, you need to modify the
~/.zshrc file and add the following text: “
fortune | cowsay | lolcat” and save the file. Then, run a new terminal, and you will find something similar on your side.
You can also use the
figlet command to accomplish the same thing.
That’s it! You have successfully installed lolcat on your Linux system. You can now use it to make the output of other commands more colourful and fun by using the
In the end, it’s all about having fun and customising your experience, so don’t be afraid to try out different tools and utilities that make working with Linux more enjoyable.
We’ll discuss another topic soon; for now, take care of yourself.
A man with a tech effusive who has explored some of the amazing technology stuff and is exploring more. While moving towards, I had a chance to work on Android development, Linux, AWS, and DevOps with several open-source tools.