Skip to content

Linux Foundations / Find your way around Linux ยท Step 12 of 63

Lesson: The ShellSwitch
โ† Linux Foundations

Shell and files

The Shell

Learn what the shell is, how to read the prompt, and how a command line is put together.

When you type a command in a Linux terminal, a program has to read that line, work out what you mean and run it. That program is the shell. The terminal is only the window that shows text and sends your keystrokes. The shell is what runs inside it.

Which shell are you using?

Many distributions give users bash by default. Others exist, such as zsh (the default on current macOS) and fish. Your login shell is usually stored in the SHELL variable:

$ echo $SHELL
/bin/bash

SHELL names your preferred shell, not necessarily the one running right now.

Reading the prompt

Before each command the shell prints a prompt. A common one looks like this:

pete@laptop:~$

Here pete is the user, laptop is the machine and ~ means your home directory. A $ at the end usually marks a normal user, and # usually marks root, the administrator account. Prompts can be customised, so yours may differ. In examples, do not type the $ yourself.

The parts of a command

A command line is split on spaces. The first word is the command, and the rest are arguments. Arguments that start with - are usually called options, and they change how the command behaves.

$ echo Hello World
Hello World
$ date -u
Sun Nov 29 12:00:00 UTC 2026

Because spaces separate arguments, extra spaces between words are ignored. To keep them, put quotes around the text:

$ echo Hello     World
Hello World
$ echo "Hello     World"
Hello     World

Case matters, and errors help

Linux treats upper and lower case as different. date is a command, but Date is normally not:

$ Date
bash: Date: command not found

"command not found" means the shell could not find anything by that name. Check the spelling first. It can also mean the program is not installed. The exact wording varies between shells and distributions.

You can practise moving around a real shell in the shell navigation lab.

Try it

  1. Run echo $SHELL and note the answer.
  2. Look at your prompt and pick out the user name, machine name and directory.
  3. Run whoami, then date.
  4. Run echo one two, then the same text inside quotes, and compare.

Check your understanding

The Shell

All 4 sections ยท no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.