Course page
Log in

You are watching a free preview. Enroll to open all 25 lessons, track progress and ask the course tutor.

Enroll now

Section 1: First steps in the shell

What the shell is and why it is worth learning

Video 8 min Lesson 1 of 25 Sample clip Preview

When you open a terminal, you are talking to a shell, a program that reads the commands you type, runs them and shows the results. On most Linux systems the default shell is bash; macOS uses zsh, which behaves almost the same for everything in this course.

Why learn it when graphical tools exist?

  • Servers have no desktop. Most Linux servers in the world are managed entirely through a shell over SSH.
  • Precision and speed. One command can rename a thousand files or find every log line mentioning an error.
  • Automation. Anything you type can be saved in a script and run again tomorrow, or every night.
  • Universal tools. Documentation, tutorials and colleagues will give you commands, not screenshots.

Anatomy of a command

ls -l /var/log
  • ls is the command: list directory contents.
  • -l is an option (also called a flag): use the long format.
  • /var/log is an argument: what to list.

Options usually start with one dash for short forms (-l) or two dashes for long forms (--all). Short options can often be combined: ls -la means ls -l -a.

The prompt

Your prompt might look like sofia@laptop:~$. It shows your user name, the machine name and your current directory, where ~ means your home directory. The $ indicates a normal user; # usually means you are root, the all powerful administrator. Be extra careful when you see #.

Getting help

Every standard command has a manual page:

man ls

Use the arrow keys or space to scroll, /word to search and q to quit. Many commands also accept --help for a short summary. The tldr tool, if installed, shows practical examples, which is often exactly what you want.

Keyboard habits that save time

  • Tab completes command and file names. Press it constantly; it also prevents typos.
  • Up arrow recalls previous commands.
  • Ctrl+C stops the running command.
  • Ctrl+R searches your command history.
  • Ctrl+L clears the screen.

Try each of them now. They are the difference between finding the shell tiring and finding it fast.

← → switch lessons