During the formative years of the computer industry, one of the first operating systems was called Unix. It was designed to function as a multi-user system on mainframes, with users connecting to it remotely via individual terminals. These terminals were fairly basic by modern standards: just a keyboard and a screen, with no power to run programs locally. Instead, they would simply send keystrokes to the server and display any data they received on the screen. There was no mouse, no fancy graphics, not even any color choice. Everything was sent as text, and received as text. Obviously, therefore, any program running on the mainframe had to produce text as output and accept text as input.
Compared to graphics, text is very light on resources. Even on machines from the 1970s, which ran hundreds of terminals over glacially slow network connections (by today’s standards), users could still interact with programs quickly and efficiently. The commands were also kept very concise to reduce the number of keystrokes needed, further speeding up people’s use of the terminal. This speed and efficiency is one of the reasons why this text interface is still widely used today.
When logging into a Unix mainframe through a terminal, users still had to manage the kind of file management tasks you can now perform with a mouse and a couple of windows. Whether creating files, renaming them, putting them in subdirectories or moving them on disk, users in the 70s could do everything completely with a textual interface.
Each of these tasks required its own program or command: one to change directories (cd), another to list their contents (ls), a third to rename or move files (mv), and so on. To coordinate the execution of each of these programs, the user would connect to a single master program that could then be used to launch any of the others. By wrapping user commands, this “shell” program, as it was known, could provide capabilities common to any of them, such as the ability to pass data from one command directly to another, or use special wildcards to work with many similarly named files at once. Users could even write simple code (called “shell scripts”) that could be used to automate long series of shell commands to facilitate complex tasks. The original Unix shell program was called sh, but it has been extended and replaced over the years, so on a modern Linux system you are more likely to use a shell called bash. Don’t worry too much about the shell you have, all the content in this tutorial will work on almost all of them.
Linux is a kind of descendant of Unix. The core part of Linux is designed to behave similarly to a Unix system, so that most older shells and other text-based programs run on it quite happily. In theory, you could even connect one of those old terminals from the 1970s to a modern Linux box, and access the shell through that. But these days it’s much more common to use a software terminal: that same Unix-style text interface, but running in a window along with your graphical programs. Let’s see how you can do it yourself!