Chapter 6. Terminal Art

All work and no play makes Jack a dull boy. Even though the command line seems boring to a lot of people, it can become great fun. It all comes down to your imagination. Terminals can be stylish and can give a good impression, especially the ones we see in the movies. Colors, ASCII art, and animations can make our terminal come alive. So, here comes some terminal art!

In this chapter, we will cover the following:

  • Working with some Linux commands to have fun with

Ever heard of fortune cookies? Do you want to have them without getting fat? Just run the following apt command to install the utilities that we will be using in this chapter:

sudo apt install fortune cowsay cmatrix
Terminal Art

Then run this command:

fortune
Terminal Art

When running this command, you get fortunes, quotes, and jokes, in a random order. If we combine the command with cowsay, we will get the same fortunes, delivered with an image of a cow:

fortune | cowsay
Terminal Art

To make this recurrent, we can include it as the last line in our zshrc file. Then, every time we open a new terminal window, a cow will deliver a fortune to us.

Now this may not be useful (even though it's kinda fun) so, let's do some productive wizardry.

Let's predict the weather!

All you need is a curl command:

curl -4 http://wttr.in/London
Terminal Art

This will show, in a nice format, a three-day weather forecast for the specified city, in this case, London:

Terminal Art

Now, with our newly learned skills, let's put together a shell script that gives us the weather forecast:

Open ~/bin/wttr and type the following:

#!/bin/bash
CITY=${1:-London}
curl -4 http://wttr.in/${CITY}

Give it execution rights and assign a default city, let's say London. Now, run this:

wttr
Terminal Art
Terminal Art

We get the weather forecast for London. Now, run this:

wttr paris
Terminal Art

We get the weather forecast for Paris. Working in the command line for the first time may seem like entering the Matrix and, if that's the case, why not create that environment?

Run this command:

cmatrix
Terminal Art

Let your friends be amazed by the complicated stuff you are doing in that cryptic terminal. Terminals are not boring!

Terminal Art

They have beautiful colors, easy-to-read output, and they display compact information that puts users in control of their own system.

Terminals can be customized and interacted with and they increase your productivity while leaving your mouse to sleep the endless sleep of inefficiency.

Of course, all these skills don't come to you overnight, and they require careful tweaking from each user in order to be tailored to their own taste and way of thinking and working. However, after that, they'll fit like a tailored suit, and become an extension of your way of work and sometimes even your job.

We hope you've enjoyed all the tips and tricks we've provided, and had fun learning them. Remember that education is a continuous process, so don't stop here! Stay hungry and surf the Internet to keep track of the latest tools and techniques that will transform you into a productivity beast!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.96.247