Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

Terminals and shells

Two programs share the work behind every line you type: the terminal shows the text, and the shell reads each line, runs the program it names, and reports how that program finished.

Typing instead of clicking

When you double-click an app, your computer starts a program. When you drag a file into a folder, it moves the file. Underneath, every click becomes an instruction to a program. A terminal skips the pictures: you write the instruction yourself, and the result comes back as text.

Whether you opened Ubuntu, macOS or the browser workspace, the same two programs share that work. The terminal is the window. It shows text, takes your keystrokes and passes them along. The shell is the program inside it that understands what you typed. It reads each line, works out which program you asked for, runs it, and shows you the result. The shell this course uses is called bash. Other shells exist, such as zsh, and they share most of the same ideas.

A useful way to picture it: the terminal is the phone, and the shell is the person on the other end of the line who carries out your requests.

Reading the prompt

When the shell is ready for an instruction, it prints a prompt. Ava's prompt might look like this:

ava@laptop:~$

Read it from left to right: ava is the user the shell is running as, and laptop is the computer's name. After the colon comes the directory the shell is working in. Directory is the terminal's word for a folder, and this course uses it from here on. ~ stands for Ava's home directory, the one that holds her own files. The $ means "ready for your command". Prompts vary between systems, and yours may look different, but most carry the same information.

Type a command after the prompt and press Enter. Try these three:

whoami
date
echo Hello from the terminal

whoami prints your username, date prints the current date and time, and echo prints back whatever follows it. After each answer, a new prompt appears, which means the shell has finished and is ready again.

Commands and arguments

Before anything runs, the shell splits the line into words wherever there are spaces. The first word is the command, the program to run. The words after it are arguments, which the shell hands to that program in order.

ls -l Documents

Here ls lists the contents of a directory. Documents tells it which directory, and -l asks for the long format, with sizes and dates. Arguments that start with a dash are called options or flags. They change how a command behaves rather than what it works on. Many options have a short form with one dash and a long form with two. curl, the tool for web requests that you installed, accepts both -s and --silent, and either one tells it to work quietly, without a progress display.

date shows an option at work. On its own it prints the time where your computer is set. date -u prints the same moment in UTC, Coordinated Universal Time, the single time zone that servers and logs use so that times recorded in different places line up.

You can see exactly how the shell split a line with printf, a command that prints text to a pattern. Its first argument, in single quotes, is the pattern: %s stands for one argument and \n starts a new line. printf repeats the pattern for each argument after it, so this prints every argument on its own line, inside brackets:

$ printf '[%s]\n' one   two   three
[one]
[two]
[three]

The extra spaces are gone: they only separated the words, and the program received three arguments. A value that should keep its spaces needs quotes, which make it one word:

$ printf '[%s]\n' "one   two   three"
[one   two   three]

echo behaves the same way. echo one two three prints the words with single spaces, because echo received three arguments and joins them with one space each; the quoted version keeps every space. Quoting has more to it, and it gets a lesson of its own later in the course.

How a command runs

Put together, one press of Enter sets off a short exchange. The shell splits the line into words and looks for a program named by the first word. It starts that program with the other words as its arguments and waits. The program prints its output in the terminal and finishes. Only then does the shell print a new prompt.

A program that finishes also hands the shell a number, its exit status. 0 means it succeeded, and any other number means something went wrong; each program documents what its numbers mean. Nothing shows the exit status unless you ask. The shell keeps the last one under the name $?, and echo $? prints it:

$ date -u
Wed Oct 28 09:15:02 UTC 2026
$ echo $?
0

Ask straight after the command you are interested in, because every command sets a new exit status, echo included. The shell can also act on this number by itself, running a second command only when the first succeeded or only when it failed.

The shell starts the program the first word names, then reports its exit status. A mistyped name starts nothing.

When something goes wrong

Mistakes in a terminal are normal and usually harmless. If you mistype a command, the shell finds no program with that name and says so:

$ dtae -u
dtae: command not found
$ echo $?
127

The exact wording varies. Ubuntu, for example, may answer Command 'dtae' not found and suggest commands with similar names. Either way, nothing ran: the shell gave up before starting any program, and it records that command-not-found failure with exit status 127.

A few habits make the terminal much easier to live with:

  • Press the Up arrow to bring back earlier commands, fix them, and press Enter again.
  • Press Tab while typing a command or file name, and the shell completes it for you when there is only one match. Press it twice to list every match.
  • Press Ctrl+C to stop a command that is taking too long or waiting for input you did not mean to give.
  • Most commands explain themselves. man ls opens the full manual for ls, which you leave by pressing q. Many commands also print a shorter summary with --help, such as curl --help.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

Ben types date -u after his prompt and presses Enter. Which program splits that line into words and starts date? 1 of 3

Choose one answer.

You run echo hello world, with three spaces between the words, and echo prints hello world with one space. Why? 2 of 3

Choose one answer.

You type dtae instead of date, then run echo $? and it prints 127. What does that number tell you? 3 of 3

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity