One can never say it enough: the terminal is a very powerful tool, and is probably the most interesting part in Unix. Among the plethora of useful commands and scripts that you can use, some seem less practical, if not completely useless. I’ve selected for you a couple of commands that are useless because they are funny, but not funny because they are useless (or maybe the other way around for some). If you are searching for ASCII art, random math curiosities, or various (in)utilities, this is the best of the useless.
Few people know this, but any Unix system comes with a built-in calendar. To access it, you can simply type:
This will display the current month. However, you can select the precise year that you want as an argument, and even the month. And to be fully useless, the option “
-j” displays Julian days (the number of days from January 1). To sum up:
2. time cat
You can use this command as a built-in timer. It will run in the background until you stop it, and will then report the time elapsed between the start and the end of its process. As useful as it may seems, it is actually quite unpractical because you cannot check its value unless you stop it. I suppose it can become handy in a very specific situation but I have trouble imagining which one exactly. To launch just type:
and to kill, use the combination “Ctrl+c”
A very peculiar command with only one ability: repeating a string until its process is killed. Again, I don’t picture where it can be useful, but who knows? The syntax is straightforward:
This command is for reversing any input (as its name suggests). When I say reverse, it means that if the input is “Linux”, the output will be “xuniL”. Pretty strange, I know.
You will enter an interactive mode. You can quit it by using the shortcut “Ctrl+c”. But
rev can also work to reverse an entire file with
It’s time to do some Maths. Let’s begin easy with the command
factor which can decompose a given number into prime factors:
I haven’t tested the limits of this command yet, but it seems pretty powerful. As a side note, prime numbers and the decomposition into prime factors is actually the basis for modern cryptography and Internet security. Knowing a little bit about them is always interesting. If you want to learn more, take a look at the RSA encryption.
6. Multiplication Tables
This is actually more a script than a command but it is impossible to ignore it when talking about funny stuff you can do in a console. By using
The terminal will display the multiplication table, nicely ordered in columns. Incredibly useless, and pretty long to remember, but you have to admit that it looks good.
A bit more complex, you can calculate an approximation of pi through commands using
This combination of commands is a little bit harder to understand, but if you really want to know,
seq generates the sequence of 4/1, 4/3, 4/4 until 4/99999 (without 4/2), paste merges these lines using a delimiter, and
bc does the final approximation using a math library.
Figlet is a command for those who love to write in ASCII art. It greatly simplifies this task as it automatically transforms any given string. It comes with a bunch of fonts, by default at /usr/share/figlet/fonts/, and you can of course add yours.
Note: You will need to install “figlet” before you can use this command.
cosway is very famous in the Linux world, but this command is not always present by default in every distribution. In Ubuntu, install it with the command:
It displays a cow in ASCII art saying whatever string you want. It comes with a couple of other characters and you can add your own. The default directory for them is /usr/share/cows/. The syntax is:
fortune displays a random sentence, in the same spirit as fortune cookies. It is not always installed by default so you may want to add it. In Ubuntu:
It comes with a very handy option: “-s” for short, which will limit to fortunes composed of one sentence or less.
The fun part is now to combine the previous commands for a funnier result. A famous combination is fortune and cowsay, which creates a cow in ASCII art telling you a random fortune:
My personal favorite is a random character from
cowsay telling you a random short fortune:
To explain briefly, it is the same as earlier: a random fortune is pushed into cowsay, but I added the option “-f” for selecting a character. The path given is a combination of listing the files from within the default directory for the characters, random sorting of this list, and keeping only the first line.
But I suppose that you could also do something like
in order to repeat a piece of ASCII art, or even
to have a cow telling you the approximation of pi.
As always when exploring the console, there are a lot of things that can be done (even if doing them seems very useless).
I tried my best to collect what I found was the funniest among the Linux commands. Retrospectively, it was pretty hard to come up with a list, since, ironically, most of the Internet is helpful for finding useful commands, not the opposite.
Can you think of more funny and/or useless commands? More combinations? Or on the contrary, a utility of those listed above? Please let us know in the comments.