Terminal survival kit

Part 1: Getting started

Introduction to agentic AI

About this lecture

A coding agent lives in the terminal, and it tells you what it wants to do in terminal language. If you cannot read that language, every “Do you want to proceed?” is a guess. This unit teaches you to read the terminal, not to become a command-line user.

  • The terminal is a text window onto the same files you see in your file browser.
  • Files sit in a tree of folders; a path is an address in that tree, and the terminal always stands in one current folder.
  • Five commands (pwd, ls, cd, cd .., mkdir) are enough to get around and to start the agent in the right place.
  • Where you start the agent is what it can work on. One course folder, never your home folder.
  • A permission request says what will run, where, and for how long you allow it. When in doubt: say no and ask the agent to explain.

This is a practical unit. Delegating real tasks comes next in First delegations; how the agent decides what to run comes in How LLMs and agents work; keeping an undo history comes in Git as undo button.

On Monday the agent asks you to approve this. Should you?

  • You asked the agent to “tidy up the project folder”. It now wants to run a command.
  • To answer, you need to know: what mv does, which files data/*.xlsx means, where old/ is, and whether it can be undone.
  • By the end of this lecture you can answer each of those, or know how to get the agent to answer them for you.

A terminal is a text conversation with your computer

  • You type a command and press Enter; the computer answers in text.
  • The prompt at the start of each line tells you who you are and which folder you are in.
  • When the prompt comes back, the computer is ready for the next command.
  • Nothing happens until you press Enter.

The terminal and the file browser show the same files

  • Finder (macOS), File Explorer (Windows) and Files (Linux) are one window onto your files. The terminal is another.
  • A file the agent creates in the terminal appears in the file browser, and the other way round.
  • Keep both open while you work with an agent: the terminal to talk, the file browser to look.

Your files form a tree, with your home folder near the top

  • Every folder sits inside another folder, up to the top of the disk.
  • Each user has a home folder. Desktop, Documents and Downloads are folders inside it.
  • The terminal writes the home folder as ~ (tilde).

The terminal always stands in one folder: the current folder

  • Every command runs in the current folder unless you say otherwise.
  • pwd prints where you are. The prompt usually shows the last part of it.
  • A new terminal window starts in your home folder.

A path is an address in the tree; it can start at the top or where you stand

  • Absolute paths start at the top (/ or C:\) and mean the same thing wherever you are.
  • Relative paths start from the current folder. The agent uses them a lot: data/survey.csv means “the data folder here”.
  • ~ is your home folder; .. is the folder one level up; . is this folder.

Windows and macOS/Linux write the same idea differently

macOS / Linux Windows
Terminal app Terminal PowerShell (in Windows Terminal)
Language zsh or bash PowerShell
Separator / \
Home folder /Users/anna, /home/anna C:\Users\anna
Top of the disk / C:\
List files ls ls or dir
  • pwd, ls, cd, cd .. and mkdir work in PowerShell too. ~ works there as well.
  • On Windows the agent may run PowerShell or bash-style commands, so you may see either.

Names with spaces need quotes, so prefer names without them

  • The terminal splits a command at spaces. cd My Documents is read as two names.
  • Quotes keep a name together: cd "My Documents".
  • Tab completion adds the quotes or backslashes for you (next slides).
  • For anything the agent will work on, use names like agentic-course, survey_2025.csv: no spaces, no å/ä/ö, lower case.

Five commands cover almost everything you will type yourself

Command Read it as What you see
pwd “where am I?” the full path of the current folder
ls (Windows also dir) “what is in here?” the names of files and folders
cd agentic-course “go into agentic-course” nothing; the prompt changes
cd .. “go up one level” nothing; the prompt changes
mkdir agentic-course “make a folder called agentic-course” nothing (silence means it worked)

Two more for convenience:

  • cd on its own (macOS/Linux) or cd ~ (all systems) takes you home.
  • open . / explorer . / xdg-open . opens the current folder in the file browser.

Watch how the commands move you through the tree

  • cd moves you; ls looks around; mkdir adds a folder where you stand.
  • The prompt is your “you are here” sign. Check it before you do anything that matters.

You can jump from the terminal to the file browser with one command

  • Use it as a habit: make or enter a folder, then open it in the file browser.
  • From now on, watch new files appear there while the agent works.

Tab and the up arrow save most of the typing

  • Tab completes file and folder names. If nothing happens, the name does not exist where you are.
  • Up arrow recalls earlier commands. Inside Claude Code and Codex it recalls your earlier prompts.

Error messages are short and usually say exactly what is wrong

You see It means Try
No such file or directory / Cannot find path the name is not in the current folder pwd, ls, then Tab to complete
command not found / is not recognized the program is not installed, or a typo check spelling; ask whether it is installed
File exists / already exists mkdir found a folder with that name nothing; the folder is already there
Permission denied / Access is denied your account may not touch that place you are probably in the wrong folder
  • Nothing is broken when you see an error. Read it, then pwd and ls.
  • In an agent session, you can paste the error and ask: “What does this error mean?”

The folder where you start the agent is the folder it works on

  • You start the agent by typing claude or codex in the current folder. That folder becomes its working folder.
  • It reads and edits there without leaving it; going outside needs your permission.

Never start the agent in your home folder or on the Desktop

  • Home, Desktop and Documents mix work, private and confidential files. The agent does not know which is which.
  • Make one folder per piece of work. Run pwd before you type claude or codex.

Make one course folder and start the agent there

macOS / Linux (Terminal)

cd ~
mkdir agentic-course
cd agentic-course
pwd
open .          # Linux: xdg-open .
claude          # or: codex

Windows (PowerShell)

cd ~
mkdir agentic-course
cd agentic-course
pwd
explorer .
claude          # or: codex
  • Text after # is a comment; you do not need to type it.
  • We use ~/agentic-course rather than Desktop or Documents. Those are often synced to iCloud or OneDrive, and macOS asks extra permission questions for them.
  • Next time: open a terminal, cd agentic-course, then start the agent.

On first start, the agent asks whether you trust the folder

  • Claude Code asks, the first time in a folder, whether you trust it. Codex may ask a similar question, depending on version and setup.
  • Yes for your own course folder. Think twice for a folder you downloaded or received: trusting it lets settings stored in that folder take effect.
  • Codex also chooses a starting permission level for the folder. Check it with /status and change it with /permissions.
  • Claude Code shows its mode below the prompt box. Press Shift+Tab to change it (next slides).

Inside the agent, you type plain language into a prompt box

  • You are now talking to the agent, not to the terminal. Write in plain English (or Swedish).
  • The agent’s work appears as tool calls (Bash(ls), Write(notes.md)) followed by its answer.

A few keys and slash commands control the session

You want to Claude Code Codex
See the commands /help, or type / type /
Stop the agent mid-task Esc Esc (see the hint on screen)
Start a fresh conversation /clear /new (or /clear, which also clears the screen)
See the current settings /status (version, model, account) /status (model, permissions, folders)
Change what it may do unasked Shift+Tab (cycles modes) /permissions
Exit /exit, or Ctrl+C twice /exit or /quit, or Ctrl+C
  • Esc stops; it does not undo. Work already done stays done.
  • After exit you are back in the terminal, in the same folder.

Everything the agent does is a read, an edit or a command

  • Reads inside the folder usually run without asking.
  • Edits show you the change. Commands can do anything your user account can do.

Permission modes decide what the agent may do without asking

  • Claude Code: Shift+Tab cycles the modes; the current one is shown below the prompt box. Recent versions start in Auto.
  • Codex: /permissions switches levels; /status shows the current one.
  • In this unit: Manual or Read Only, so that you see and practise reading requests.

A permission request says what will run, why, where, and for how long

  • Read the command itself, not only the agent’s reason. The command is what runs.
  • Check the folder: everything should stay inside your project folder.

You have three answers: yes once, yes from now on, or no and say what instead

  • Claude Code: Yes / Yes, and don’t ask again for … / No. Press Tab to add a note to your answer; Esc means No.
  • Codex: similar choices: approve once, approve similar commands for the session, or decline and tell Codex what to do differently.

When in doubt, say no and ask the agent to explain the command

  • “What does this command do? Explain in plain words. Do not run it.” works for any command.
  • Ask for the consequences: which files, can it be undone, does it use the network?

You will see the agent run a small set of commands again and again

Command Plain English Risk
ls, pwd list files; show the current folder none: only looks
cat file, head file show a file; show its first lines none: only looks
mkdir name make a folder low
cp a b copy a to b low, but can overwrite b
mv a b move or rename a to b medium: overwrites b without warning
rm file, rm -r folder delete; delete a folder and all inside high: no wastebasket, no undo
Rscript x.R, python x.py run an R or Python script depends on the script: ask what it does
git status, git log show what changed; show history none: only looks
git add, git commit save a snapshot low (see Git as undo button)
curl, pip install, install.packages fetch from or install from the internet ask: what, and from where?

rm and mv deserve a slow read every time

  • Before you approve rm or mv, ask yourself: is there a copy? If not, ask the agent to list the files first.
  • Until you have git (Git as undo button), make a copy of anything precious before the agent touches it.

The agent can install software for you, one approved step at a time

  • Later units need R, Python and git. Ask: “Which of R, Python and git are installed on this computer? Only check, do not install anything.”
  • If something is missing, ask for a plan first: which installer, from where, which commands. Approve each step after reading it.
  • Some steps need your password or a system dialog. The agent cannot do those; you do them, then tell it you are done.
  • On a university-managed computer, check with IT before installing anything.

Where this goes wrong

  • Wrong folder. The agent was started in home or Desktop, or a relative path points somewhere you did not expect. Check pwd first.
  • Approval fatigue. After the tenth “yes” people stop reading. If you are pressing yes without reading, slow down or narrow the task.
  • “Don’t ask again” for too much. Allowing rm * or mv * for a project removes your last check. Prefer plain yes.
  • Trusting the summary over the command. The one-line reason can be incomplete; the command is what runs.
  • Esc is not undo. Stopping keeps what was done. Real undo comes with git, in Part 2.
  • The screens change. Option names and modes change between versions. Read what is on your screen; ask the agent or /help when in doubt.

Summary

Concept Key fact
Terminal a text window onto the same files as the file browser
Folder tree, home ~ files sit in nested folders; your home folder holds Desktop, Documents, …
Current folder where commands run; pwd shows it, the prompt hints at it
Paths absolute from the top (/, C:\); relative from where you stand; .. = up one
Five commands pwd, ls, cd, cd .., mkdir; plus open . / explorer .
Starting folder the agent works in the folder you start it in: one course folder, never home

Summary (continued)

Concept Key fact
Session control Esc stops; /help or /; /clear or /new; /exit
Permission modes Claude Code: Shift+Tab (Manual for now); Codex: /permissions (Read Only for now)
Permission request what, why, where, how long; yes once / yes always / no and say what
Escape hatch “What does this command do? Do not run it.”
rm, mv no wastebasket; silent overwrite. Is there a copy?

Next (First delegations): three small jobs in your course folder (organise a messy folder, clean an Excel file, summarise a few PDFs into a table), reading and approving each step as you go.