Terminals

You may have heard that a picture is worth a thousand words. It’s an idiom with a lot of truth—sometimes rather than describing something to somebody, you get through a lot faster if you just show them. But on the other hand, Edgar Allen Poe’s ‘The Raven’ is about a thousand words long—could you replace it with a picture?

Text-based computer interfaces and video-based computer interfaces have coexisted for essentially the entire history of computer interfaces. Neither one is first or original or better, but the two media certainly have different strengths and weaknesses. Human interface can change a lot about how a computer system gets used, and it’s worth understanding a little bit of unix history to understand why some of its text-based facilities are designed the way they are.

Teletype

In the 19th century, to go along with telegraph technology, there was a kind of machine called a teleprinter or teletype, which is much like a typewriter but it sends what you type away on a wire, and/or recieves those signals and types itself so you can see the message. Since they already existed and communicated electrically, it was natural to adapt the teletype for use as an early computer interface. When research UNIX was being developed and first used, it was on a PDP-11 computer and the interface was a Teletype Model 33, like this one.

Teletype Model 33

The text is literally printed on paper, so for example, backspace moves the cursor to the left but the ink can’t be erased, so it is impossible to easily fix typos, but it is possible to type ‘é’ by typing ‘e’, backspace, and then an apostrophe. All of your commands and the computer’s responses are recorded on a long roll of paper for you to take and review later if you wish. For security, when you are typing a password, ‘local echo’ is temporarily disabled so that your password isn’t left printed on the sheet for someone to come by and read.

A Teletype Model 33 types at about 100 words per minute. Humans hired to do typing are typically expected to sustain above 60 WPM, so the teletype is certainly fast by that standard. However, I typed this paragraph at around 90 WPM, and the fastest human typists can go twice as fast as a Model 33. Waiting for a line or two of text to print isn’t painful, but it does take several seconds, and the number of characters that fit in one screen update of an 80×24 video terminal would take over three minutes to display on a teletype.

Thus, people who worked with this sort of interface developed a preference for terse inputs and outputs. Everything is abbreviated. ‘List’ becomes ‘ls’, ‘C compiler’ becomes ‘cc’, ‘convert and copy’ becomes ‘dd’ (because ‘cc’ was already taken!), ‘standard input and output’ becomes ‘stdio’, and so on. ‘Teletype’ itself is ‘tty’. Programs print requested information and error messages, but often have no output on success. For those used to this style, it feels more efficient, cleaner somehow. But it’s not necessarily a strength, particularly when it gets taken too far. Ken Thompson was once asked what he would do differently if he were given a chance to design UNIX again from scratch, and he said, ‘I’d spell creat with an e.’1.

Another interesting consequence of this interface is that the thing you’re sitting at isn’t the computer. A teletype is desk-like, but it is connected by wires to the actual computer which is sitting aside somewhere else in the room or even in another room. For this reason, the interface is called a ‘terminal’, i.e. one endpoint of a communication where the computer itself is the other end. Sometimes a desk-like terminal might also be called a ‘console’, as in the furniture terminology for a cabinet or decorative base.

Video terminals

As video technology became cheaper, computers started being equipped with video monitors that were designed to display text and could emulate familiar teletype interfaces, even to the extent of sometimes being called a ‘glass tty’.

One influential early video terminal is the ADM-3A, which was installed at Berkeley when important early unix programs were being developed.

ADM-3A

The vi text editor, developed at Berkeley, uses the hjkl letter keys to move the cursor left, up, down, and right respectively. Take a closer look at the ADM-3A keyboard.

closeup of the hjkl keys on the ADM-3A keyboard

On that video terminal, holding down the control key gave the user access to arrow keys on those letters! Writing software to use those characters directly as movement commands was just a savings by not requiring the control key.

The keyboard layout also had ‘^’ and ‘~’ (caret and tilde) on the same key (shift for tilde). Holding down control and pressing that key took the cursor to its home position, and the key was therefore also labeled ‘Home’. In many places in unix, either tilde or caret is used to mean home or beginning.

A later video terminal, the DEC VT100, became the literal standard for how software could expect to control cursor position, color, and so forth on all future video terminals.

DEC VT100

Kinds of interfaces

The acronym GUI is commonly used for ‘Graphical User Interface’, i.e. those based on a metaphor using windows, icons, menus, and a pointer often controlled by a mouse. The graphical display is often structured as a ‘desktop’, as though it was a top-down view of the top of a desk covered in paper files being worked on. This sort of GUI is descended from Doug Engelbart’s Mother of All Demos which led to interface research at Xerox PARC and eventually became widespread through its influence on Apple.

The acronym CLI, for ‘Command-Line Interface’, refers to the interface model descended from the teletype hardcopy terminal. The user types a line of text, which is interpreted as a command for the computer to carry out. The computer answers, and then prompts the user to enter another command line. The actual program running on the computer that interprets the command and carries it out is called a ‘shell’ (because it is the thin layer around the computer that you can see). Metonymously, people often call a CLI a command line (after the kind of thing a user puts into the system), a command prompt (after the text written to prompt the user to type another command), or a shell (after the program on the other end of the terminal).

Video terminals, although they are intended to emulate hardcopy terminals, are by their nature graphical, so there are some differences. Printing a character over another now replaces it, rather than overtyping like on paper. Although that requires a new plan for composing accented characters, it does mean that now the user can erase what they have typed, and go back and forth editing the line of input they are typing before they hit enter to commit to it. Text can now easily use multiple colors. Furthermore, because text can be rewritten and the cursor can be instantly repositioned, a program can ‘draw’ text all over the screen.

One of the first programs to take advantage of the video terminal was the vi text editor, which could now take advantage of showing a whole page of text at once and allowing the user to move a cursor around in the file and dynamically show what the file looked like as they edited it. The game Rogue took video terminals to the next level, by drawing a mazelike dungeon for an adventurer to explore.

exploring a dungeon in Rogue

This kind of interface, lacking pixel-based images like a GUI but nonetheless two-dimensional and often colorful unlike the monochrome and sequential CLI, is called a Text User Interface or TUI.

Remote shell access

It used to be the expectation that a computer would sit somewhere else and the user would sit at a terminal, merely an interface to the remote computer. As computers became smaller and more widespread, it became common to actually sit at the computer, with a tower sitting right next to the monitor and keyboard, or even all put together into a laptop. However, it is still very common for people to use a machine in front of them as only a very thin interface to enable them to actually access another, remote machine. It is particularly common for web developers to need to access their servers remotely, or for system administrators to need to log in to various machines throughout the network they administer. Keeping work centrally on a server is also a good way to make it location-independent, for one person who needs to be able to move around a lot and always be able to reach out to their main system, or for a team of people who can work together on the shared system from a variety of access points.

It is possible to remotely access a graphical user interface, and at times very useful. However, moving a screenful of graphics across the network is a lot more work than moving a screenful of text. So, it is much more common for remote access to be through a program such as ssh, the ‘secure shell’, which runs a CLI shell on the remote computer and carries text back and forth between the local host and the remote server.

(In unix, the GUI has been designed with a client–server architecture so that a program can be running on the server but the graphical rendering is done locally, and only relatively simple instructions about what to draw have to be moved back and forth. This enables a cheaper sort of remote graphical login compared to a full remote desktop. If you’re curious, you can look into ‘X forwarding’ with ssh.)

Because of the primacy of text for remote computer access, it is important for computer users who expect to be doing it much to be comfortable with working at the console.

Another influential keyboard

One of the most influential keyboard designs in hacker history is the space-cadet keyboard.

space-cadet keyboard

The space-cadet keyboard was designed in the late seventies at MIT, so whereas the ADM-3A had its influence on Berkeley-derived unix culture, this keyboard had its influence on MIT-derived hacker culture. Among its notable features is its wide array of modifier keys.

closeup of the hyper, super, meta, and control keys on a space-cadet keyboard

In addition to shift, control, and the usual, it had ‘hyper’, ‘super’, and ‘meta’. The preference for being able to type complicated text by holding down ‘chords’ (like on a piano) of multiple keys is characteristic of software such as the emacs text editor that came out of MIT. Documentation for emacs still uses ‘M-’ as a prefix to mean hold down the ‘alt’ key, as in ‘M-x’ to mean typing ‘x’ while holding down ‘alt’, because ‘alt’ is the closest thing IBM-style keyboards have to a ‘meta’ key.

Terminal emulators

Modern computers equipped with high-resolution monitors, using graphical user interfaces, typically have a way to access a text-based interface. There is cmd on Windows, for example, which brings up a DOS-like command line, and both macOS and Linux have a variety of programs called ‘terminal emulators’. A terminal emulator is a GUI program that emulates a VT100 video terminal emulating a Teletype Model 33 hardcopy terminal.

a terminal emulator

As an interface, a terminal emulator is usually staying pretty close to its CLI roots. The user types a line of text and issues it to the shell, which interprets it as a command to carry out, coming back with a prompt for the next command. However, interactive line editing and at time full-blown TUI programs make their appearance as well, and because a terminal emulator is running within a GUI, it can launch or interact with other programs that are fully graphical. The result is a combination of interface styles that can adapt to whatever style of interface is best for the work being done, and being able to fluently move back and forth between command line and graphical programs is a crucial skill for a modern computer user, especially a hacker.

Notes

1

‘The UNIX Programming environment’ by Kernighan and Pike, p. 204

You have attempted of activities on this page