The funny side of Linux command line

By | 15/04/2013

Have you ever seen a train running on Linux command line? Have you ever seen ‘Tom and Jerry’ on Linux command line? Well, working on Linux command line is not that serious always. There lies a fun factor too. Here in this space, we shall discuss the idiosyncrasies of Linux command line.

Assumption: Ubuntu Linux is used for all the examples in this article. The command line utilities described in this article may or may not be present by default on your Linux system.

 

Funny and interesting Linux command line utilities

1. Linux ‘sl’ command

Although ‘sl’ stands for ‘steam locomotive’, it was created to jazz up commandline addicts who, in a haste, sometime mistype ‘ls’ command as ‘sl’. Let us unveil what it does by running it on our system.

First we need to install it as it doesn’t come along with standard Linux. However, it is pretty convenient to install it using ‘apt-get’

sudo apt-get install sl

Most of the installation needs sudo privileges. When it is done, type ‘sl’ on the command prompt

$sl

We see an impressive animated steam locomotive loving across the screen from right to left. The locomotive has been drawn using ASCII characters.

Here is how the output looked on my machine:

1_sl

(Click image to enlarge)

Isn’t is so different than what we see and do on Linux Command line everyday? I think it will definitely bring a smile on the face of the lieux user who was deeply absorbed into running something and realises his typo error on seeing something unexpected and amazing as this animation.

Well, even this simple command have certain options to offer. Here is the excerpt from its man page

SYNOPSIS
   	sl [ -alFe ]

DESCRIPTION
   	sl Displays animations aimed to correct users who accidentally enter sl instead of ls.  SL stands for Steam Locomotive.

OPTIONS
   	-a 	An accident seems to happen. You'll feel pity for people who cry for help.

   	-l 	shows little one.

   	-F 	It flies.

   	-e 	Allow interrupt by Ctrl+C.

One can play a prank on someone by

$alias ls=sl

Caveat: Enjoy at your own risk!

2. Linux ‘yes’ command

Here is a command which just prints the input string repeatedly unless the process is killed. In case, the user does not specify any input string, the default is ‘y’.

This is how the command runs like

$yes mylinuxbook
mylinuxbook
mylinuxbook
mylinuxbook
mylinuxbook
mylinuxbook
mylinuxbook
mylinuxbook
mylinuxbook
mylinuxbook
mylinuxbook
mylinuxbook
mylinuxbook
mylinuxbook
^C$

We kill the foreground running process by ‘ctrl + c’.

Strange, isn’t it? Why would we want a command to keep on printing a string all the life of the process? Though the way it works is silly, but it might not be useless. We can use ‘yes’ command in certain scripts where we want to feed the same answer in a repeated operation. For example, we are doing an operating on a set of files and Linux asks us to confirm for each and every file. We can auto-feed a yes using the ‘yes’ command.

3. Linux ‘rev’ command

Although very simplistic, I found this command very fascinating. It reverses all the input strings given to it line by line. The name of the command ‘rev’ comes from reverse. To play around, type the command ‘rev’ on the command prompt and press enter

$rev

We’ll be prompted by the terminal to provide a string through standard input line by line. We can see the output spontaneously after each line.

Like, here we give the input as ‘mylinuxbook’ and press enter.

mylinuxbook
koobxunilym

To get back to the command prompt, the golden trick of ‘ctrl+c’ works.

We see the reversed string as output on the next line. Again we can type the next string which we want it to be reversed and on pressing enter we get the output on the standard output.

$ rev
google
elgoog
linux is fun
nuf si xunil
^C$

This command also takes the input in the form of a file, where it reverses all the strings line wise in the file and prints the output to the standard output.

$ cat strings.txt
MyLinuxBook
Linux is so much fun!
Happy Birthday
$ rev strings.txt
kooBxuniLyM
!nuf hcum os si xuniL
yadhtriB yppaH

4. Linux ‘fortune’ command

The fortune command is in the same lines as fortune cookies. We get a random adage or a message when we run this command.
It needs an explicit installation first,

$sudo apt-get install fortune

Once the installation is done, the way we run this command is

$ fortune
You have the power to influence all with whom you come in contact.

So with this command, Linux can even stand by us as a fortune teller.

5. Linux ‘figlet’ command

This displays our input string in large characters as banners formed out of ASCII characters.

We need to install this utility as it doesn’t come along with standard.

$sudo apt-get install figlet

This is really amusing to watch our string drawn big on the terminal.

$ figlet mylinuxbook

The snapshot of output:

2_figlet

(Click image to enlarge)

One can add such banners in the scripts headers or sources using ‘figlet’.

6. Linux ‘toilet’ command

I have no idea where this command got it’s name. However, its a very colourful command. Similar to figlet, it displays our text as banners but in a prettier way.

First of all, installation:

$sudo apt-get install toilet

Lets try the simple command :

$toilet mylinuxbook

The output looks like:

3_toilet

(Click image to enlarge)

It is much different and artistic than figlet.

However, it has some colours to offer too. Lets see by running following command

$toilet -f mono12 -F metal mylinuxbook

This is what I get on my system :

4_toilet

(Click image to enlarge)

7. Linux ‘cowsay’ command

The cowsay command is an amusing command. It depicts the power of ASCII characters to draw a cow, sheep, and many other animals. However it might not always be present in every distribution of Linux.

Use following to install on Ubuntu Linux:

$sudo apt-get install cowsay

Now run the command giving it a message string,

$cowsay “Linux is fun”

We see an interesting figure,

5_cowsay

(Click image to enlarge)

Basically, we see a cow which is saying the message as per the command input. Although the command name suggests a cow, it also offers to draw a sheep which is saying a message.

$cowsay -f sheep “I too love linux”

The snapshot image I get is

6_cowsay

(Click image to enlarge)

To have all the capabilities as to what all animals it can draw, just use option ‘-l.

$cowsay -l

I get following set on my system.

Cow files in /usr/share/cowsay/cows:
apt beavis.zen bong bud-frogs bunny calvin cheese cock cower daemon default
dragon dragon-and-cow duck elephant elephant-in-snake eyes flaming-sheep
ghostbusters gnu head-in hellokitty kiss kitty koala kosh luke-koala
mech-and-cow meow milk moofasa moose mutilated pony pony-smaller ren sheep
skeleton snowman sodomized-sheep stegosaurus stimpy suse three-eyes turkey
turtle tux unipony unipony-smaller vader vader-koala www

Therefore, we can input any of the above animals with the ‘-f’ option.

To make it even more fun, one can pipe fortune message to cowsay as

$fortune | cowsay

I get following output

7_fortune_cowsay

(Click image to enlarge)

8. Linux ‘cmatrix’ command

This command produces a ‘Matrix’ style animation made of ASCII on the terminal.

Lets install it first

$sudo apt-get install cmatrix

Now run it,

cmatrix

It is really awesome what we get. I won’t say much. Just enjoy!

8_cmatrix

(Click image to enlarge)

Its an animation so do check it yourself.
To terminate and come out of animation, use ‘ctrl+ c’ key combination.

9. Linux ‘oneko’ command

This is the best of all. I just love it. We all know ‘tom and jerry’, and this command reminds us their chasing game. With this command, we see a cat (I call it tom) which is chasing our mouse (the mouse pointer, tom calls it jerry).

Without further delay, installing works as

$sudo apt-get install oneko

Running the command, we do

oneko

And you can enjoy seeing tom running towards wherever we move the mouse pointer. Though a snapshot can do no justice to the actual version. Still, just as a breather here is a snapshot:

9_oneko

(Click image to enlarge)

The cat i.e tom won’t leave the mouse(jerry) even if we switch the application. That is its not limited to the terminal even.
When you are done, just terminate the process from the terminal by ‘ctrl + c’.

 

Conclusion

We hope the readers enjoyed knowing about these funny and interesting Linux command line utilities. If anyone knows more of such commands, please leave a comment.

15 thoughts on “The funny side of Linux command line

  1. Matt

    You may want to check the install command you’ve listed for the cowsay command. It currently says “$sudo apt-get install toilet”

    Reply
    1. Rupali Post author

      Thanks Matt. It has been corrected.
      Hope you liked the article.

      Reply
    1. Rupali Post author

      Thanks Lubos, that tells linux is a guy. :)

      Reply
    2. Jakub

      Install package funny-manpages, there are lots of useful manpages (rtfm, date, echo)…

      Reply
  2. IFB

    Well, if we go for oldies like “man woman” we can also mention

    $ make love
    make: *** No rule to make target `love’. Stop.

    I supposed the error meesage was revised at some point in GNU make. I used to simply say “Don’t know how to make love”.

    Reply
  3. Toodlelew

    “To get back to the command prompt, the golden trick of ‘ctrl+c’ works.”

    Yes, by sending SIGINT to the attached process, and only if the terminal is set to interpret ^C as SIGINT (see the output of “stty -a” to find out what your “intr” (SIGINT) control character is – stty can also change this value).

    A much saner way to terminate an interactive process is to send it “EOF”, usually a ^D. Again, settable and reportable through the stty command.

    Reply
  4. edadre

    Curious, there is no “Linux command line”, and not one single thing you described involved Linux except for its role as the operating system kernel.

    Nothing,zero, nada … all of it is the GNU operating system in which you were using the GNU BASH shell. ie, The GNU command line.

    See:

    http://www.gnu.org

    and learn :-)

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *