The Shell

From Coder Merlin
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder


A shell is a user interface that provides access to an operating system's services. Two basic types of shells are used: a "command-line interface" (CLI) and a "graphical user interface" (GUI). You are likely familiar with common GUIs from Microsoft Windows and perhaps Apple’s macOS. This document focuses on a CLI known as Bash, a shell for the Unix operating system by Brian Fox. Bash is an acronym for Bourne-again shell, named for the Bourne shell that it replaces. Log in to the Merlin Server as discussed earlier. After some introductory text, you'll see a prompt (letting you know that the server is ready and waiting for your input) which will look something like this:

john-williams@codermerlin:~$ 

You'll see your login name, an at (@) sign, the name of the server ("codermerlin"), a colon (:), a tilde (~), and a $. This will be followed by a flashing block called a cursor. The cursor indicates where new characters will appear as you type. The cursor will continue to flash patiently as it awaits input. We'll get back to the meaning of the tilde soon.

We'll be using a server running Linux, a Unix-like operating system. Almost everything in Unix is either a file or a process. A file is either a destination or source for a stream of data. A process is a program that is being executed by the operating system. While printers and screens are considered to be "files" in Unix, a more general way of thinking of files is a collection of data that can be referred to by name. Files can be created by users directly (for example, via a text editor) or indirectly, such as the result of running a program like a compiler.