Mihail Radu Solcan

  Why in the Beginning was the Command Line?

2007-11-22

The title of a well-known essay written by Neal Stephenson is In the Beginning was the Command Line. You may find in Wikipedia an abstract of Stephenson's essay. 

Despite the title, Stephenson's text is about operating systems. I would like in this note to focus on the command line itself. 

Most people would find the command line scary. Some find it fascinating. Why? 

Let us start with a very informal discussion of an example of a formal system. First, the formal system is made up of letters (the letters of the English alphabet). Second, there are commands for the manipulation of the letters. 

Let's go now to the command line and the Bash interpreter that one can easily find in any GNU/Linux distribution. The Bash interpreter has an in-built command called "echo". In its simplest syntactic form we write first the name of the command; then we write a string (a sequence o letters enclosed in inverted commas). Like that:

> echo "kitty"

kitty

It's easy to do this as an exercise. And remember that the string "kitty" has no meaning! It is just a sequence of letters. The formal system is like a game with letters. 

Let's try to add some fun to the game. The command named "echo" has a series of options. We write, under GNU/Linux, the options in the usual way. For example, a minus followed by the letter e is the sign that backslashed-escaped characters in the string should be interpreted as commands. 

> echo -e "kitty\ncat"

kitty

cat

The backslash followed by n is a command for newline

In fact, each letter has a code. We could work with those codes too (read echo's manual for details). 

> echo -e "kitty\ncat\x73"

kitty

cats

Well, it's fun. At least, for some people. 

There are more important things in the command line than fun. Put all the contents of the command line in a file. Run the file from the command line (you must have execution permission for this file):

./kitty.sh

The effects on the screen are the same, but you don't have to use the command line each time. This is a script

Now, someone who sees this kind of game for the first time might say "well, I'm not interested; I want to press a button". The person wants a GUI (graphic user interface), not a CLI (command line interface). 

Now, there is a problem with the GUI. Let us say that each time we press a button we execute a script. How many scripts? It depends. The GUI may also contain options and all kinds of menus. 

Read however the following quotation:

No matter how many palettes of buttons

and how many menu options are offered,

users of a program will always want to do

something the author has not foreseen.

Adding still more buttons and menus is

not the answer.

Hayes (1995) 1 

That's the bare truth. It would be possible to put back in the GUI the command line, but this was not the initial aim of the guy who wanted just to press a button. 

Is the GUI good for something? Yes. It is very useful when we use very similar scenarios of action. It is useful because it helps us to visualize some operations within a complex formal system. For example, it is a good tool when we copy and move files around (see the note on the use of panels). 

The command line is however fundamental. It is especially significant when we treat the computer as a kind of formal system. 

There are a lot of things I do from the command line. In effect, on a GNU/Linux system you could do everything from the command line. We could read files, search in files and many other things. The final image is just another very simple example:

Looking in a file

Note

1 Epigraph used in TUGboat 19, 2, quoted by Christina Thiele, The Treasure Chest, in TUGBoat 20,1, p.56.