Terminal Vitality
Ever since Douglas Engelbart flipped over a trackball and discovered a mouse, our interactions with computers have shifted from linguistics to hieroglyphics. That is, instead of typing commands at a prompt in what we now call a Command Line Interface (CLI), we click little icons and drag them to other little icons to guide our machines to perform the tasks we desire.
Apple led the way to commercialization of this concept we now call the Graphical User Interface (GUI), replacing its pioneering and mostly keyboard-driven Apple // microcomputer with the original GUI-only Macintosh. After quickly responding with an almost unusable Windows 1.0 release, Microsoft piled on in later versions with the Start menu and push button toolbars that together solidified mouse-driven operating systems as the default interface for the rest of us. Linux, along with its inspiration Unix, had long championed many users running many programs simultaneously through an insanely powerful CLI. It thus joined the GUI party late with its likewise insanely powerful yet famously insecure X-Windows framework and the many GUIs such as KDE and Gnome that it eventually supported.
GUI Linux
But for many years the primary role for X-Windows on Linux was gratifyingly appropriate given its name - to manage a swarm of xterm windows, each running a CLI. It's not that Linux is in any way incompatible with the Windows / Icon / Mouse / Pointer style of program interaction - the acronym this time being left as an exercise for the discerning reader. It's that we like to get things done. And in many fields where the progeny of Charles Babbage's original Analytic Engine are useful, directing the tasks we desire is often much faster through linguistics than by clicking and dragging icons.
A GUI certainly made organizing many terminal sessions more visual on Linux, although not necessarily more practical. During one stint of my lengthy engineering career, I was building much software using dozens of computers across a network, and discovered the charms and challenges of managing them all through Gnu's screen tool. Not only could a single terminal or xterm contain many command line sessions from many computers across the network, but I could also disconnect from them all as they went about their work, drive home, and reconnect to see how the work was progressing. This was quite remarkable in the early 1990s, when Windows 2 and Mac OS 6 ruled the world. It's rather remarkable even today.
Bashing GUIs
But the terminal has always focused on efficiency. As the debut interface to the Unix family of operating systems in the heady days of 1971 when 110 baud was "the high-speed connection", shortening "copy" to "cp" and "list" to "ls" doubled efficiency and counted as a big win. Imagine the improvement that shortening "concatenate" to "cat" achieved! But those are small potatoes compared to collecting commands, for bash or any number of other scripting languages specified by the shebang, into a text file to be repeated as needed by merely typing its name.
And like an elephant, bash never forgets. The history command was added in 1978 to recall the most recent commands, now up to a thousand of them by default. While many decry Facebook's determined attempts to know your deepest secrets, bash does this properly, storing your command history in a private file on your local machine where it belongs. These commands were numbered to allow you to repeat them with a literal bang - that is, !42
will repeat the earlier command numbered 42. And bash's history feature anticipated Google as well. A CTRL-R initiates a search in reverse through the entire command history to find a matching command, which you can edit or execute directly. I'm still waiting for a practical history of my clicks and drags.
Some interaction certainly benefits from points and clicks. I wouldn't create great art with a keyboard, even if I could create great art any other way, and the venerable text-only Lynx web browser isn't exactly challenging Firefox or Chromium these days.
But for those of us who are lazy not in the way that earned you reprimands or worse from your parents and teachers but that led you to the world of computers and automation, performing your tasks linguistically instead of with hieroglyphics opens the door to a glorious world of efficiency and productivity. It's something worth writing about, don't you think?
More on Technologies Discussed
- Gnu screen permits multiplexing a physical interface such as a Gnome Terminal or Konsole window, ssh connection, or non-GUI terminal among many virtual sessions. Particularly useful with a secure shell (ssh), terminal sessions may be left running while disconnected, and then reconnected when the next ssh session begins. A non-GUI terminal (call a tty, for teletype - they once literally typed letters over a telephone landline) may be opened in most Linux distributions in parallel to your desktop using CTRL-Alt F1 to F7, and Gnu screen works wonderfully here as well. One of those ttys is running your GUI, but finding it is up to you.
- The shebang (short for "hash bang") is the first line of a text file intended to be run as a script, specifying which interpreter program should be passed the contents of the remaining lines in the file. For bash, the traditional, more secure, and more flexible shebang is `#!/bin/bash`
, although some young kids on my lawn told me they prefer the more portable `#!/usr/bin/env bash`
. If you prefer writing Python commands to bash, `#!/usr/bin/env python3`
is the shebang for you.
```bash #!/bin/bash # Convert all office documents to PDF find . -name '*.od?' -o -name '*.xls*' -o -name '*.doc*' -o -name '*.ppt*' | while read file ; do soffice --headless --convert-to pdf "$file" done ```
- To flip a bit and make your text file named linguistic_brilliance run exactly as a binary program would run, try `chmod a+x linguistic_brilliance`
. This [ch]
anges the file [mod]
e to give [a]
ll users permission to e[x]
ecute that file. See how much time these short commands save? And you might save your finger nubs as well by trying `lin[TAB]`
instead of the full filename, since the Tab key requests your shell to complete what you want to type from context. If it beeps rudely at you, hit it again (the Tab key, I mean), and your shell should give you a list of what it considers happy endings to help you along.
- CTRL-R begins searching your command history for whatever you type. Additional control-r presses will search for the next match, moving backward in time. Tab will select the command currently found, placing the cursor at the start of the match for editing. Enter will execute the command shown. It's all very proper and productive, though not entirely obvious.