AI Learning Hub › Learn AI › Self-Paced Courses › Terminal on Mac: Reading Commands Before You Run Them
Course · Beginner
Terminal on Mac: Reading Commands Before You Run Them
Find your way around the command line on a Mac, read an unfamiliar command and say what it will touch, and decide whether to run it — including the ones an AI agent hands you.
The terminal runs what you type, immediately, without asking. This course teaches you to read a command — where it will run, which files it will touch, and what it will change — before you press Return.
Most people arrive at the terminal sideways. A setup page says to paste a line in. A colleague sends three commands. An AI assistant finishes a sentence with a block of text and the instruction to run it. None of those situations call for writing commands from memory, and all of them call for reading one you did not write.
That is the skill this course is built around. It teaches the commands, because you cannot read what you have never met, but the commands are in service of the reading. By the end you should be able to look at an unfamiliar line, say which folder it will run in and which files it will reach, and decide on that basis whether to run it.
The copy, the move, the removal and the redirect all do their work silently. Nothing stops to confirm. The moment before Return is the only checkpoint there is.
What this course covers
It starts with orientation — what the window is, what the shell is, and how to find out where you are — because almost every confusing result in the terminal comes from a command running somewhere other than where you assumed. It then takes command syntax apart: the command, its options, its arguments, how to read the manual page that is already on your machine, and why a filename with spaces in it needs quoting.
From there it covers the commands that make, copy, move and remove things, with particular attention to the fact that none of them ask first. It covers reading and searching text, pipes and redirects, and the error messages you are most likely to meet. The ninth module turns all of it on a command an agent wrote: six questions, asked in order.
The capstone is a short block of proposed commands that mostly does what was asked. One line in it reaches further than the task required, and finding that line is the exercise.
What it deliberately leaves out
This course is macOS and zsh only. There are no Windows instructions and no PowerShell equivalents, because the two are genuinely different and a course that hedged every sentence would teach neither well. A separate Windows course is planned.
It also stops short of shell scripting. Variables, loops, conditionals and script files are a different skill, and they are not what you need in order to read a line somebody handed you. Package managers, permissions, networking and text-processing tools such as sed and awk are out of scope for the same reason.
Format
Nine modules, a capstone and a sources page, each on its own page, with an exercise in every module and a small practice folder to work in.
Time
About 115 minutes in all, in sittings of 9 to 13 minutes. The capstone takes about 16.
Written for
Students, faculty and staff at Stanford Law School who have never used the command line, or who have pasted commands in without being sure what they did. No programming experience assumed.
What you need
A Mac, the Terminal application that is already on it, and the practice folder below. No account, no AI subscription, and nothing to install.
The practice folder
Every exercise runs inside one small folder of invented research material: two opinions, three sets of notes, and two empty folders to put things in. Nothing in it is real, nothing in it matters, and you can re-create it in seconds.
- Download it using the button below.
- Unzip it. Your Mac will create a folder named
terminal-practice. Put it in your home folder, which is where the course assumes it is. - Treat it as disposable. If an exercise goes wrong, delete the folder and unzip the download again. That is the point of it.
Run the commands in this course only inside the practice folder. Several of them remove or overwrite files, and they do it without confirming. Do not run them against your Desktop, your Documents, or any folder holding work you would miss.
Command behavior in this course was observed on macOS 26.6 with zsh 5.9 and Terminal 2.15 in October 2026, in a temporary folder created for the purpose. Your prompt will look different from the screenshots; the commands and their output are the part to compare. See Where This Came From for the evidence behind each claim, including what this course could not establish.
The course
-
Module 01 · Beginner
What You Are Looking At
The terminal is a window, the shell is the program reading what you type, and zsh is the one your Mac uses. Telling them apart is what makes the error messages legible later.
Start module -
Module 02 · Beginner
Where You Are
Every command runs somewhere. The current directory is what a relative path is measured from, and answering “relative to what?” is the foundation of everything after this.
Start module -
Module 03 · Beginner
Reading a Command
Command, option, argument. How to read a manual page, why a filename with spaces breaks without quotes, and why man rather than --help is the way into the Mac’s built-in tools.
Start module -
Module 04 · Beginner
Making, Copying, and Moving Things
Creating folders and files, and the first commands that will replace something without asking you first.
Start module -
Module 05 · Beginner
Removing Things
The shortest module and one of the most important. What rm takes, what rm -r takes, and how a single asterisk decides how many files are involved.
Start module -
Module 06 · Beginner
Reading and Searching Text
Looking inside files without opening an application, searching for text across a folder, and the quoting lesson hiding inside the find command.
Start module -
Module 07 · Beginner
Putting Commands Together
A pipe sends one command's output into another. A redirect sends it to a file, and one of the two forms empties that file first.
Start module -
Module 08 · Beginner
When Something Goes Wrong
Four error messages worth recognizing, how to stop a command that is still running, and why sudo deserves a pause rather than a reflex.
Start module -
Module 09 · Beginner
Reading a Command an Agent Wrote
Six questions to ask of any command you did not write, and what to do with a multi-line block that arrives ready to paste.
Start module