1.2. The Prompt

The text that a shell displays for its prompt will differ depending the shell program itself and a user’s profile settings. Consider the two prompts shown in the introduction. Intentionally presented, the bash$ prompt is similar to what a Bash shell would produce, and the zsh% prompt is similar to what a Zsh shell would produce. In this tutorial, we will not present any features that are specific to either of these shells; instead, we will focus on general Unix commands using syntax that is supported by both.

To keep things simple, we will follow a standard convention of denoting the prompt with a single $ character. Therefore, if you see a line of text in this book that begins with a single $ character, then it means that the text after the $ character represents a command that should be typed at a prompt. In such examples, the first $ character is not part of the command. To emphasize this, consider the following example of the date command:

date

Note

If you are reading the online version of this book, then the $ character should not be selectable nor will it be included when using the “copy” button that appears when you hover over the command.

When you try to execute the command on your own, do not include the first $ character in what you type or paste into your terminal emulator. If you forget to omit it, then your shell will interpret it as part of the command itself. This is illustrated in the figures below.

../../_images/prompt-correct.png
../../_images/prompt-incorrect.png