← All lessons
Command line basics · Lesson 1 of 7

The terminal

Linux runs most of the world's servers, phones (Android is built on it) and a lot of laptops. You can use it with a mouse, but the real power is in the command line: a window where you type commands and the computer answers in text.

The window is the terminal. The program inside it that reads what you type is the shell; on most systems it's Bash, and macOS uses a close cousin, zsh. Everything in this course works in both.

The shell shows a prompt when it's ready, something like sam@laptop:~$. That's your user name, the computer's name, the folder you're in (~ means your home folder) and a $ that means "type here". In the examples, the $ is the prompt: type what comes after it, then press Enter.

$ whoami
sam
$ echo Hello, duck
Hello, duck

A command is a program name, then options, then arguments, separated by spaces. In ls -l Documents, ls is the program (list files), -l is an option that changes how it works (the long, detailed list) and Documents is the argument it works on. Short options are a dash and a letter, and you can bunch them: ls -l -a is the same as ls -la. Long options use two dashes, like --help.

Commands are case-sensitive: ls works, LS doesn't. Most commands print nothing when they succeed, so silence usually means it worked.

Practice

What is the shell?

More info

Quick reference

terminalThe window you type commands into.
shellThe program that reads and runs them; usually Bash.
$The prompt: the shell is waiting for you.
~Your home folder.
-x, --longA short option, a long option.
echo textPrint the text back.

The other Linux courses