ping·aiCSTU · CSE 642 · Foundations · The terminal
Part A · The words

Why learn the terminal

Most developer tools, and every Coding Agent App, work through it.

The terminal is a text window where you type instructions to your computer. You do not need to memorize commands. You need to know what to call things so you can ask for the right one.

macOS and Linux use shells called zsh or bash. Windows uses PowerShell. Most everyday commands look the same in both.

Slide 1 of 13

Read this deck as an article

The same content as the slides above, in one page.

Why learn the terminal

Most developer tools, and every Coding Agent App, work through it.

The terminal is a text window where you type instructions to your computer. You do not need to memorize commands. You need to know what to call things so you can ask for the right one.

macOS and Linux use shells called zsh or bash. Windows uses PowerShell. Most everyday commands look the same in both.

Two places you type

A terminal takes exact commands. A Coding Agent App takes plain-language prompts.

The Terminal

A text window where you type exact commands. The shell inside it runs each command the moment you press Enter.

  • Spelling and spacing must be exact.
  • macOS and Linux use zsh or bash. Upper and lower case matter there: Git is not git.
  • Windows uses PowerShell. It does not care about case in command names, but type them as shown anyway.
  • Names inside a command, such as Linux file paths, branch names and image names, can be case-sensitive in any shell.
  • The two kinds of shell have different commands: ls -la works in zsh and bash, while PowerShell uses Get-ChildItem -Force.

Terminal command, macOS and Linux (zsh or bash, case-sensitive): ls -la

Terminal command, Windows PowerShell (command names are not case-sensitive): Get-ChildItem -Force

A Coding Agent App

It looks like a chatbot, but it does much more: it can read your project files, run commands, edit code and use tools, and it often asks your permission first. Product names and features change fast and differ a lot, so these decks use one group name for all of them.

Examples: Kiro, Claude Code Desktop, GitHub Copilot's desktop app, Google Antigravity, the Codex and ChatGPT desktop apps, OpenCode, Hermes, LangChain's Deep Agents desktop app, and others. Which one you use does not matter here.

  • Plain language is fine. Say what you want, and use the right names for things.
  • Capital letters and small slips are forgiving; the meaning is what counts.
  • It may run terminal commands for you. Read what it proposes, especially anything that deletes files or sends data.
  • Pasting a command into the prompt does not guarantee it runs as typed. Ask for the result you want, or ask the app to explain the command first.
Prompt for a Coding Agent App: “What changed in my project since the last commit? Explain it in plain words.”

The same job, two ways

Terminal command, Any shell: git status

In a terminal you type the exact command. In a Coding Agent App you describe what you want.

Six words, part 1

Each card gives the word, what it means, and a sentence you can say to a Coding Agent App.

Terminal
The window you type in.
Prompt for a Coding Agent App: “Open a terminal in this project folder.”
Shell
The program inside the terminal that reads your commands and runs them: zsh, bash or PowerShell.
Prompt for a Coding Agent App: “Which shell am I using?”
Command-line interface (CLI)
A program you control by typing commands instead of clicking, such as git or docker.
Prompt for a Coding Agent App: “Is there a CLI for this?”
Command, argument, flag
The program name, the thing it works on, and an option that changes its behavior.
Prompt for a Coding Agent App: “Explain each part of this command.”

Six words, part 2

Path
The address of a file or folder. Absolute starts at the top of the disk; relative starts from where you are.
Prompt for a Coding Agent App: “Give me the relative path from here to that file.”
Working directory
The folder the shell is in right now.
Prompt for a Coding Agent App: “What folder should I be in to run this?”
Environment variable
A named setting the shell and programs can read, such as HOME or PATH.
Prompt for a Coding Agent App: “Which environment variables does this app need?”
PATH
The list of folders the shell searches when you type a command name.
Prompt for a Coding Agent App: “Why is this command not on my PATH?”

Wrong word, right word: “the black window” is a terminal; “the folder I am in” is the working directory.

Where am I, and how do I move?

These work in macOS/Linux shells and in PowerShell.

Terminal command, macOS and Linux (zsh or bash, case-sensitive): pwd

Terminal command, Windows PowerShell (command names are not case-sensitive): pwd

Show the folder you are in In PowerShell, pwd is an alias for Get-Location.

Terminal command, macOS and Linux (zsh or bash, case-sensitive): ls

Terminal command, Windows PowerShell (command names are not case-sensitive): ls

List what is in this folder In PowerShell, ls is an alias for Get-ChildItem, and dir also works.

Terminal command, macOS and Linux (zsh or bash, case-sensitive): cd folder

Terminal command, Windows PowerShell (command names are not case-sensitive): cd folder

Go into a folder Same in both. Use cd .. to go up one level and cd ~ to go home.

Lost? Run pwd to see where you are and ls to see what is here.

Working with files

macOS/Linux on the first line of each card, PowerShell on the second.

Make a folder

Terminal command, macOS and Linux (zsh or bash, case-sensitive): mkdir notes

Terminal command, Windows PowerShell (command names are not case-sensitive): mkdir notes

Same in both shells.
Make an empty file

Terminal command, macOS and Linux (zsh or bash, case-sensitive): touch todo.txt

Terminal command, Windows PowerShell (command names are not case-sensitive): New-Item todo.txt

Windows PowerShell has no touch command.
Show a file

Terminal command, macOS and Linux (zsh or bash, case-sensitive): cat todo.txt

Terminal command, Windows PowerShell (command names are not case-sensitive): cat todo.txt

In PowerShell, cat is an alias for Get-Content.
Copy

Terminal command, macOS and Linux (zsh or bash, case-sensitive): cp a.txt b.txt

Terminal command, Windows PowerShell (command names are not case-sensitive): cp a.txt b.txt

In PowerShell, cp is an alias for Copy-Item.
Move or rename

Terminal command, macOS and Linux (zsh or bash, case-sensitive): mv a.txt notes/

Terminal command, Windows PowerShell (command names are not case-sensitive): mv a.txt notes/

In PowerShell, mv is an alias for Move-Item.
Delete

Terminal command, macOS and Linux (zsh or bash, case-sensitive): rm a.txt

Terminal command, Windows PowerShell (command names are not case-sensitive): rm a.txt

Deleting here is permanent: there is no trash can.

Windows PowerShell has no touch command. In Windows PowerShell 5.1, curl is an alias for another command; use curl.exe for the real curl.

Reading a command

`docker compose up -d --build`

docker
The program The first word is what you are running.
compose up
Subcommands Tell the program which job to do.
-d
A flag (short form) Runs in the background. Short flags start with one dash.
--build
A flag (long form) Rebuilds first. Long flags start with two dashes.

Ask your AI: “Explain this command piece by piece before I run it.”

PATH, and “command not found”

Symptom
zsh: command not found: git, or PowerShell: “The term 'git' is not recognized” The shell cannot find that program.
Usual causes
Not installed, not on the PATH, a typo, or the terminal was open before you installed it Close the terminal, open a new one, and try again.
Check it (macOS/Linux)

Terminal command, macOS and Linux (zsh or bash, case-sensitive): which git

Prints where the program is, or nothing.
Check it (PowerShell)

Terminal command, Windows PowerShell (command names are not case-sensitive): Get-Command git

Prints the program, or an error.

Show your PATH with echo $PATH on macOS/Linux, or $env:PATH in PowerShell.

Pipes and redirects

Join commands and save their output.

  • A pipe, |, sends the output of one command into another: docker compose logs | more shows long output one page at a time.
  • A redirect, >, writes output to a file instead of the screen: ls > files.txt. It replaces the file; >> adds to the end.
  • PowerShell passes objects through pipes instead of plain text, but the idea is the same.

Say to your AI: “Save the output of this command to a file I can send to support.”

Keys that save time, and one safety rule

Ctrl + C
Stop the running command Use it to stop docker compose up or a dev server.
Up arrow
Bring back the last command Keep pressing to go further back.
Tab
Finish a file or folder name Saves typing and avoids typos.
clear / cls
Clear the screen clear on macOS/Linux and PowerShell; cls also works in PowerShell.
Copy and paste
Use your system shortcut macOS: Cmd + C and Cmd + V. Windows Terminal: Ctrl + C copies only when text is selected; otherwise it stops the command.
Safety
Do not run a command you do not understand Ask your Coding Agent App to explain it first. Never run commands that delete things from a source you do not trust.

Common errors and the words to use

No such file or directory / Cannot find path
You are in the wrong folder, or the name is wrong Run pwd and ls, then try again.
Permission denied
Your account may not use that file or folder Do not reach for sudo first. Ask your Coding Agent App what the file's permissions mean.
Running scripts is disabled on this system (Windows)
PowerShell's execution policy blocks the script Run a script you trust once with powershell -ExecutionPolicy Bypass -File script.ps1.

Say it to your Coding Agent App

Name the shell and your system, and paste the exact error.

Prompt for a Coding Agent App: “I am on Windows using PowerShell. How do I list the files in this folder?”
Prompt for a Coding Agent App: “This command fails with: <paste the exact error>. What does it mean and what is the smallest fix?”
Prompt for a Coding Agent App: “Explain this command piece by piece before I run it: <command>.”
Prompt for a Coding Agent App: “Which folder should my terminal be in to run this?”
  • Never paste keys or passwords into a prompt.