By the end of this lesson you will be able to
- Explain the difference between the terminal window and the shell running inside it.
- Open the Terminal on Ubuntu in two different ways.
- Read a prompt and split a command into its command, option and argument.
- Run three safe commands and tell normal output from an error message.
Almost everything you do on a computer can also be done by typing short instructions instead of clicking. That is the Command line, and it is how most servers, programmers and system administrators work. It can look frightening at first, but a terminal only does what you type, and the commands in this lesson cannot harm your computer. Learning to read it calmly is the first step to every Linux skill that follows.
Terminal and shell: two different things
People say 'terminal' for the whole black or purple window, but two things are working together inside it. The Terminal is the window itself. It shows text and passes your key presses on. The Shell is the program running inside it. It reads what you type, works out what you mean and asks the Operating system to do it. On Ubuntu the default shell is called Bash.
Think of a restaurant. The terminal is the table and the notepad: it is where you write down your order and read the answer. The shell is the waiter who understands your order and carries it to the kitchen. The kitchen is the operating system, which actually does the work. You could change the waiter without changing the table, and that is why the same terminal can run different shells.
Your request goes down; the answer comes back up
Read this figure as text
A stack of layers showing you at the top, then the terminal window, the shell called Bash, and the operating system at the bottom.
Four layers from top to bottom. 1: You, typing a command. 2: The terminal, the window that shows text and passes your keys on. 3: The shell (Bash), which reads your command and decides what it means. 4: The operating system (Linux), which does the real work such as listing files. The answer travels back up the same way and appears as text in the terminal.
Opening the terminal on Ubuntu
Two ways to open Terminal on Ubuntu 24.04
Step 1: Use the keyboard shortcut
Hold Ctrl and Alt together and press T.
You should see: A window opens with a line of text ending in a dollar sign, and a blinking cursor after it.
Step 2: Or search for it
Click Show Apps (the grid of dots at the bottom of the dock), or press the Super key (the key with the Windows logo), type
terminaland click the Terminal icon.You should see: The same terminal window opens.
Step 3: Close it when you finish
Type
exitand press Enter, or click the close button of the window.You should see: The window closes. Nothing is lost, because you have only read information.
Reading the prompt
The line of text before your cursor is the Prompt. It is the shell saying 'I am ready for your next command', and it also gives you facts about where you are. A typical Ubuntu prompt looks like this:
amina@laptop:~$aminaUserWho is logged in@AtSeparatorlaptopComputerThis machine's name:ColonSeparator~LocationYour home folder$ReadyNormal user; type hereRead this figure as text
The prompt amina@laptop:~$ broken into labelled parts: user, at sign, computer name, colon, location and dollar sign.
The prompt amina@laptop:~$ has these parts. amina is the user name of the person logged in. The at sign separates the user from the computer. laptop is the name of this computer. The colon separates the computer name from the location. The tilde (~) is the current location, meaning your home folder. The dollar sign means a normal user is logged in and the shell is ready for a command. You do not type the prompt; it appears by itself.
In this course, examples show the prompt as $ so you know where a command starts. Never type the `$` yourself. When you see $ whoami, you type only whoami. If the last symbol of a prompt is # instead of $, the shell is running as the all-powerful Root account. A beginner should rarely see that, and we will explain why later.
Anatomy of a command
A Command is one instruction to the shell. Most commands have up to three parts, separated by spaces: the command name (what to do), then options (how to do it), then arguments (what to do it to). An option usually starts with a dash. An Argument is the thing the command acts on, such as a folder name.
lsCommandWhat to do: list SpaceSeparates parts-lOptionHow: long, detailed list SpaceSeparates partsDocumentsArgumentWhat to look atRead this figure as text
The text ls -l Documents broken into three labelled parts: the command, the option and the argument.
The command line ls -l Documents has three parts. ls is the command name and means list the contents of a folder. -l is an option that changes how the list is shown, giving one detailed line per item. Documents is the argument, the folder the command should look inside. Parts are separated by spaces, and the order is command first, then options, then arguments.
Your first three commands
These commands only display information. They change nothing, so you can try them freely. echo prints back whatever words you give it. whoami prints the name of the user you are logged in as. pwd stands for 'print working directory' and prints where you currently are.
echo Hello from my terminal
whoami
pwdType each line and press Enter after it. The expected output, using the fictional user Amina, is shown in this simulated terminal. The /home/amina line is the full address of your Home directory.
- Marker 1: echo repeats your words
- Marker 2: whoami shows your user name
- Marker 3: pwd shows where you are now
Read this figure as text
A simulated terminal showing three commands and their outputs: a greeting, the user name amina and the path /home/amina.
A simulated bash terminal in the home folder. First prompt line: echo Hello from my terminal, with the output Hello from my terminal (marker 1). Second prompt line: whoami, with the output amina (marker 2). Third prompt line: pwd, with the output /home/amina (marker 3). After each output a new prompt appears, which means the shell is ready again.
Output and error messages
Most commands print their result and return to the prompt. A command that succeeds with nothing to say often prints nothing at all. Silence usually means success. When something is wrong, the shell or the command prints an error message. Errors are not scary: they are the computer telling you precisely what it did not understand. Read the message from the left. It usually names the command, then the reason.
- Marker 1: Typing mistake: the shell does not know the command
- Marker 2: The command is right but the name you gave does not exist
Read this figure as text
A simulated terminal showing a misspelled command with a command not found error and a missing folder with a no such file error.
A simulated bash terminal. First the learner types lss, a misspelling of ls, and the shell replies: Command 'lss' not found, did you mean command 'ls' from deb coreutils. This is marker 1: the shell does not know that command. Second the learner types ls Pictures2, and the reply is ls: cannot access 'Pictures2': No such file or directory. This is marker 2: the command exists but the folder named does not. Each error is followed by a fresh prompt, and nothing was changed.
The exact wording of the first message can differ slightly between Ubuntu versions. Older ones print lss: command not found. Either way, the meaning is the same: check your spelling, and check that you typed a space where one belongs.
Practise in the simulated terminal
Type the commands from this lesson into a safe simulated terminal. It has a practice folder, and nothing it does touches your real computer. Try a misspelling on purpose to see the error.
Loading lab…
Common mistakes
✖ Instead of: Typing the
$at the start of an example command.✔ Do this: The
$is the prompt. Type only the words after it.✖ Instead of: Leaving out the space, as in
ls-l, or using capitals, as inLS.✔ Do this: Separate the command, options and arguments with spaces, and type in lower case: Linux commands are case sensitive.
✖ Instead of: Copying and pasting commands from the internet without reading them.
✔ Do this: Read each part and look it up first. If you cannot explain what it does, do not run it.
If something goes wrong
- Ctrl+Alt+T does nothing.
- Click the window you were using first, then try again. If it still fails, press the Super key, type
terminaland open it from the search results. Some keyboards need the shortcut set in Settings, then Keyboard. - I type but nothing appears.
- Click inside the terminal window so it has focus. Also check that the window is not showing a program waiting for input rather than the prompt.
- I pressed Enter and the terminal shows a command not found message.
- Compare what you typed with the lesson, letter by letter. Look for a missing space, a capital letter or a misspelling, then retype it.
Key terms
- Terminal
- A window where you control the computer by typing text commands.
- Shell
- The program in a terminal that reads the commands you type and carries them out.
- Command line
- A way of controlling a computer by typing commands instead of clicking.
- Prompt
- The short text in a terminal that shows it is ready and waiting for you to type a command.
- Command
- A typed instruction that tells the computer to do something.
- Argument
- Extra information you give to a command so it knows what to work on.
Practise it for real
Reading is not the same as being able to do it. Complete these on your own computer, then tick only what you have actually done. These ticks are your own honest record: nothing checks them for you.
Run your first commands on your own laptop
Open Terminal on your Ubuntu laptop using Ctrl+Alt+T. Type echo followed by a sentence of your choice, then whoami, then pwd, pressing Enter after each. Then misspell a command on purpose, for example whoam, and read the error. Finally type exit to close the window.
Challenge: take a command apart
On paper, write the command ls -l Pictures. Underline the command name, circle the option and draw a box round the argument. Then write what you think would happen if you left out the space between ls and -l, and test your prediction in the simulated terminal above.
Knowledge check
6 questions. You need 80% to pass. Mistakes here are part of learning, and you can retry as often as you like.
Summary
- The terminal is the window; the shell (Bash) is the program that understands your commands.
- Open Terminal on Ubuntu with Ctrl+Alt+T or by searching for it.
- The prompt tells you who you are, which computer you are on and where you are. You never type it.
- A command line is command, options, arguments, separated by spaces.
- Error messages explain what went wrong. Read them, check spelling, and never run commands you do not understand.
Checklist: can you do these?
Marking a lesson as read does not prove you can do it. Skills count as demonstrated when you pass the quiz (not yet) and complete the practical tasks (not yet).
Related lessons
References and further reading
Official sources for details that can change between versions.
- The Linux command line for beginners (Ubuntu)
- Bash Reference Manual (GNU Project)