TExcelTAD
Home › Terminal & Command Line › Terminal Intro

Terminal Intro

A terminal is a window where you control the computer by typing commands instead of clicking. You type a line, press Enter, and a program called the shell reads it, runs it and prints the result. That is all there is to it, yet this simple loop is how developers install tools, run builds, manage servers, automate boring jobs and fix systems that have no graphical interface at all.

This course teaches the command line on every major operating system at once. Each task is shown side by side for the four shells you are most likely to meet:

Shell Where you meet it Prompt used in this course
CMD (Command Prompt, cmd.exe) Windows, old scripts, .bat files C:\Users\ada>
PowerShell (7.x, pwsh) Windows (modern default), also macOS and Linux PS C:\Users\ada>
bash Linux, WSL, servers, Docker containers, Git Bash ada@ubuntu:~$
zsh macOS (the default since 2019), many Linux desktops ada@macbook ~ %

You don't have to learn all four in depth. Most people use one every day and only need to read the others. By the end of this course you will be able to sit down at any computer, open a terminal and get work done.

Why learn the command line?

  • Speed. Renaming 300 photos, finding every file that mentions TODO or copying a folder tree to a backup drive takes one line.
  • Repeatability. A command can be saved in a script and run again tomorrow, on another machine, or by a colleague. Clicks can't.
  • Access. Servers, containers and cloud machines usually have no desktop. The terminal (often over SSH) is the only way in.
  • Developer tools. Git, Node.js, Python, compilers, Docker, kubectl and cloud CLIs are command-line programs first.

Your first commands

Here is the same "say hello and show where I am" task in each shell. Press Run on any of them: the examples in this course are executed on the real shells, so what you see is exactly what the shell prints.

Windows (CMD)

cmd · try it yourself
@echo off
echo Hello from CMD
cd
Hello from CMD
C:\Users\learner

In CMD, cd without arguments prints the current folder.

Windows (PowerShell)

powershell · try it yourself
Write-Output "Hello from PowerShell"
(Get-Location).Path
Hello from PowerShell
/tmp

The playground runs PowerShell 7 on Linux, starting in /tmp. On Windows the same command prints something like C:\Users\ada.

Linux & macOS (bash/zsh)

bash · try it yourself
echo "Hello from bash"
pwd
Hello from bash
/home/learner
zsh · try it yourself
print "Hello from zsh"
pwd
Hello from zsh
/home/learner

echo works in zsh too; print is a zsh extra. pwd means print working directory.

How the examples work

Every lesson follows the same pattern:

  1. A short explanation of the task.
  2. One subsection per platform: Windows (CMD), Windows (PowerShell) and Linux & macOS (bash/zsh), with zsh shown separately only where it behaves differently from bash.
  3. A comparison table you can come back to as a cheat sheet.

There are two kinds of code blocks:

  • Runnable playgrounds have a Run button and an output block. You can edit the code and run it again. They are verified on real shells: CMD through Wine's implementation of cmd.exe, PowerShell 7, GNU bash 5 and zsh 5.9, each in a fresh, empty sandbox. Each example creates the files it needs, so nothing you do can break your computer.
  • Sessions without a Run button show what you would see on your own machine: a prompt, a command and its output. They are used for things a sandbox can't do, like opening Finder, installing software, or showing your network settings. Their output is marked as sample output when the values depend on your machine.

The sandboxes have a few quirks worth knowing:

Sandbox Starts in User
CMD C:\Users\learner learner on computer TAD
PowerShell /tmp (Linux paths, no C: drive) —
bash / zsh /home/learner (empty) learner on host tad

Note the zsh sandbox runs on Linux, so it uses the GNU versions of tools like ls and sed. macOS ships the BSD versions, which differ in a few options; the lesson BSD vs GNU Tools covers the differences.

What this course covers

text
Terminal Basics   terminal vs shell, apps on each OS, the prompt, getting help
Files & Folders   paths, cd, listing, creating, copying, deleting, viewing, searching, wildcards
Shell Skills      redirection, pipes, chaining, variables, PATH, quoting, shortcuts, aliases
Platform Guides   Windows Terminal, WSL, macOS Terminal, zsh, BSD vs GNU, Linux terminals
Everyday Tasks    package managers, processes, admin rights, networking, SSH, editors
Scripting         a first script on each OS, cross-platform scripts, a cheat sheet
Practice          exercises and a mini project

Where to go deeper

This course is a guide that shows the common ground. When you want to master one shell or understand what happens underneath, follow the links to the dedicated courses:

Learn more: Terminal, Console & Shell · Opening a Terminal

Test yourself

Which program reads the command you type and runs it?

  1. The terminal window
  2. The shell
  3. The keyboard driver
  4. The file manager

What is the default shell in the Terminal app on current macOS?

  1. bash
  2. PowerShell
  3. zsh
  4. fish

Which command prints the current folder in bash and zsh?

  1. cd
  2. dir
  3. pwd
  4. where