Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 2.75 KB

File metadata and controls

24 lines (17 loc) · 2.75 KB

What is a shell?

There are a few key vocabulary that we should understand before diving in to this topic, and it helps to start with some history.

Terminals

In the old days, computers interfaced with their human operators mainly through text. Very early on, this involved teletypes: automated typewriters that could both send and receive text. These were the first terminals, but by the 1980s, they had mostly been replaced by video-based terminals: still dedicated devices with screens and keyboards, usually separate from a computer. Today, the word "terminal" usually refers to a terminal emulator, a program that runs on a computer and operating system with a full GUI and that emulates the behavior of these machines.

We still see traces of this lineage in modern operating systems: on Linux, if you run ls /dev/tty*, you will see a number of files, each representing some kind of "terminal device"—one that communicates via text. TTY stands for teletype or teletypewriter.

Command Line Interface

Even within the constraints of a terminal or terminal emulator, there are a number of ways of interacting with a computer: for instance, you might implement hotkeys like Alt-Tab to switch a program, or use arrows to navigate menus. A command line interface (CLI) is a certain method of interacting with a computer: the user sends commands as lines of text, and the program responds with its own lines of text.

Shells

Generally, a shell is a program that interacts with an operating system: Windows has a Windows Shell, Linux has various shells such as KDE or Gnome, and macOS has various components that make up its shell.

In the context of command-line tools, though, a shell is a CLI that allows access to the operating system. This type of shell is generally older than the graphical shells above, and is generally accessed using a terminal emulator.

One of the most important shells is the Bourne shell, also known as sh. Developed at Bell Labs, its syntax became the (literal) standard for the majority of computers in the world. With sh, you can create scripts, manage files, configure your operating system, and much more.

The Bourne Again Shell, more commonly known as Bash, is a free program that extends the features of sh with additional syntax and capabilities. It is the default on most Linux distributions, and is the shell we will be using today.

There are other common shells: on Windows, Command Prompt and Powershell; macOS defaults to zsh; and many users on all systems prefer alternatives like fish or tcsh.

Exercise

Make sure you can answer the following questions. Check with an organizer if you are unsure!

  • How is a shell different from the terminal?
  • What is the default command-line shell on my computer?