I like the command line and in many ways I prefer the command line over the graphical interface. I wonder, what is it that makes the command line so useful?
I bet a large part of it is learned and has become a force of habit. To list the files in a directory and perhaps sort the files by date isn't hard in either the CLI or GUI, but in the CLI it just flows out of my fingers. This highlights a fundamental difference immediately.
If the destination is known this is done blindly on the command line. I start typing. Hit Tab
every few characters to invoke autocomplete and hit Enter
.
To navigate a nested directory structure in a graphical interface the items have to be presented on the screen. Then I scan the files and directories until I found what I was looking for. My screen is of finite size so I might have to scroll. Repeat for every directory level. So human and computer resources are spent to make this action intuitive.
I admit that Windows has come a long way and the example is somewhat contrived. I can just hit the Super
key and start typing. In a way this is a command line, but there is more to it than that.
Text has infinite space
The graphical interface provides visual cues. Graphical symbols present possible actions and guide the user. The main distinction is because the display is of finite size symbols are hidden behind menus, windows and scrollbars.
On the command line the user builds and maintains a mental image of what the computer can do. This is just like I would do in a graphical interface, except more abstract. The characters typed on the keyboard form an infinite number of symbols. No need to navigate anything.
The graphical system wins on discoverability. Whereas for the command line I read manuals or handbooks to learn commands the graphical lends itself to experimentation. This is lower friction.
As a side effect of the infinite space command line applications develop many options. For example, for listing the contents of a directory: file size in bytes, sort by extension, apply a filter and dozens more. A graphical user interface for all these options would grow large. This is not a technical limitation, but it might incentivize developers to reduce functionality to reduce visual information.
Programmability
On the command line all is expressed as text. It's common to write a script with a few commands, then tell the computer to run it as a sequence of commands. How do I do this on a graphical interface? There is no method to express graphical symbols other than point and click. I can't draw or describe graphical symbols and have the computer understand. Symbols have to present on the screen.
There is no technical reason graphical interfaces are not programmable. It's more cultural. One counter example is Blender in which every button I press is transcribed as Python code so I can make it into a script. More grahical interfaces support things like macros, but it's the exception rather than the rule.
Digital computers operate on binary values. Binary is difficult to comprehend, but second best is the written language. Starting from assembler and higher level languages above it we create programs and data structures and assign symbolic names to them. All of these symbols eventually resolve to binary addresses, dynamically or statically.
Written language and computers have in common that they use unambigously distinct symbols. Characters are encoded in binary format, then composed into an infinite number of words or symbols. Language has the benefit that humans ascribe meaning to it. We nailed this human computer interface thousands of years before the computer.
Leanness
It amazes me how useful this text paradigm has proven to be and how relatively simple hardware can provide this interface. Before graphical interfaces we had terminals. Hardware devices that exclusively dealt with text.
Terminal applications or hardware maintain a character buffer and displays it on the screen. This relatively simple device can runs on a low bandwidth serial line and can harness the full power of the computer. This legacy lives on in terminal emulators and is especially useful when working on a remote computer.
The right abstraction
Unless what I'm doing is inherently visual the interface doesn't have to be.
The command line uses the same language of symbolic names that software is build with. The graphical interface invents it's own language with curated symbols and lacks expressiveness. I get it and it has good applications, but something is lost in the process.