appzasGamesToolsDevLearnCheat sheetsQuick calcsConvertersReferenceNetworkTimeCalculatorsCompareLLM prices

The terminal and the shell

Lesson 1 of 58 minBeginner

What the terminal is, how a command is built and how to move between folders.

The terminal is a window where you type text commands. The shell (usually bash or zsh) is the program inside it that reads what you type and runs it. Almost everything on a Linux server is done this way, including over SSH.

The prompt

ana@laptop:~$

It shows your user (ana), the machine (laptop) and where you are (~, your home folder). The $ means you are a normal user. A # means you are root, the administrator.

Anatomy of a command

ls -l /var/log
│   │  └── argument: what to act on
│   └── option: changes how it behaves
└── command: what to run

Where am I and what is here?

pwd          # print working directory
ls           # list files
ls -l        # long format: permissions, owner, size, date
ls -la       # also show hidden files (names that start with a dot)
cd /var/log  # go to an absolute path
cd ..        # go up one level
cd ~         # go home
cd -         # go back to the previous folder

Absolute and relative paths

  • An absolute path starts at the root /, for example /etc/ssh/sshd_config. It works from anywhere.
  • A relative path starts from where you are. . is the current folder and .. is the parent.
  • ~ is shorthand for your home folder.

Help is built in

ls --help     # short summary
man ls        # full manual page (press q to quit)

NotePress Tab to complete names, and the up arrow to bring back earlier commands. Both save a lot of typing and mistakes.

Test yourself

Answer all the questions, then check them. Finish with every answer right to mark the lesson as done.

HintIt stands for "print working directory".
HintThe parent folder is written with two dots.
HintCombine the long and "all" options.
4. What does a $ at the end of the prompt usually mean?

Key terms