Commandline Intro

The commandline is a magical place of wizards & wizardry. It's talking to a computer where special incantations make "things happen." It's also a deep, dungeon full of beasties and evil powers that require great responsibility! All is not so scary though, if you are willing to dig into it's arcane mysteries you find a powerful way to work with your computer.

A Little History

The origins of the commandline are traced back to the Teletype, a mechanical typewriter that could send and receive text over (originally) telegraph & (later) telephone lines. You could record keystrokes to a paper tape and then play them back while transmitting to another terminal or you could send information live, although this would take much longer since the keys were hard to press!

Each key & associated character had a simple number of electrical pulses representing it which became the origin for the ASCII character standard. The Bell, Line Feed, & Carriage Return characters owe their origin to the mechanical nature of the original Teletypes.

When digital computers were being developed, it was natural to use the existing Teletype interface as a way to talk to a computer. Many of the first commercially available mainframes came with Teletype terminals. In the image above, Dennis Ritchie, the inventor of Unix, is using a Teletype with a DEC PDP 11 mainframe.

As computers became more powerful and started to support multiple people using them simultaneously, the Teletype terminal evolved into the mainframe terminal: a keyboard with a CRT display instead of the typewriter for output. This form factor then evolved into the familiar computer of today.

The commandline itself may have been supplanted by the GUI (Graphical User Interface), but it still exists on all major desktop operating systems in the form of "terminal emulators", ie. programs that create a virtual representation of the original mainframe terminals. For the major operating systems, the following programs fill this role:

Windows: DOS prompt, Powershell

OSX: Terminal.app

Linux: xterm, Konsole, Gnome Terminal/VTE, etc

Basic Idea

The commandline is essentially a text-driven interface for computing. You have a conversation with the computer by telling it to do something and then wait for a reply.