
The terminal: the minimum you need to work with agents
The terminal is a text interface. Learn the basic commands, how to move between folders and which commands delete with no trash, so you can review an agent.
What is the terminal and why does it matter with agents?
Ubuntu’s beginner tutorial defines it like this: “The Linux command line is a text interface to your computer.” You type a line, the system answers with text, and there are no buttons or menus. The text shown before the cursor, called the prompt, tells you the computer is ready to accept a command.
For someone designing with AI, the key point is that an agent such as Claude Code works in that same place. When the agent reads a file, runs a test or deletes something, it does so with commands like the ones in this article. If you recognize them, you can review what it tried to do instead of accepting blindly.
The tutorial describes Linux. The macOS Terminal accepts the same basic commands as the table below. Windows has equivalents, but with different options, so check an option before copying it from this article.
What are the basic commands?
| Command | What it does | Example |
|---|---|---|
pwd | Shows the folder you are in | pwd |
ls | Lists files and folders (ls -a includes hidden ones) | ls |
cd | Changes folder | cd projects/site |
mkdir | Creates a folder | mkdir prototypes |
cp | Copies a file | cp logo.svg logo-v2.svg |
mv | Moves or renames | mv draft.md final.md |
rm | Deletes a file | rm draft.md |
According to the Ubuntu tutorial:
cdwith nothing after it takes you to your home folder.- The
-poption ofmkdiralso creates any missing parent folders. - To the command line, renaming is moving a file from one name to another, which is why
mvdoes both. - The up and down arrow keys move through the history of commands. You can recall an earlier one, edit it and run it again.
One more detail: if the destination of mv already exists, the Linux manual says it is replaced by default, unless you use -i (asks for confirmation) or -n (does not overwrite).
Which commands delete with no way back?
Ubuntu’s tutorial is blunt: rm does not move files to a trash folder, it deletes them “totally, utterly and irrevocably”. The rm manual adds a nuance: with enough time and technical expertise some of the contents may be recoverable, but that is not something to count on.
Three things make rm more dangerous:
- Wildcards. The asterisk
*means “zero or more characters”, sorm *.pngdeletes every PNG in the folder, including the ones you forgot were there. - The
-roption. It makesrmwork recursively: it deletes folders with everything inside. - The
-foption. It ignores files that do not exist and never asks for confirmation.
Two options protect you. rm -i asks for confirmation before each removal, and rm -I asks once when more than three files are about to be deleted or when the deletion is recursive.
The practical rule: before accepting an rm, run ls with exactly the same pattern and check the list. If you do not know which files match, do not run it: ask the agent to explain it first. And check that anything important has a copy, for example in Git.
This counts double with agents. Claude Code’s documentation warns that its checkpoints cover files the agent edits with its own file tools, but not files that only a terminal command touched. In other words, an rm run by the agent is not restored with /rewind. The documentation also states that checkpoints work alongside git, not in place of it.
How do you use the terminal with an agent?
An agent runs these commands for you. Your job is to read three things: which command ran, what it returned and whether that matches what you asked for. You do not need to understand every option; you need to notice when something does not add up, such as a command that touches a different folder than the one you expected.
Claude Code’s documentation shows three concrete uses of the terminal with the tool:
- Piping the output of another command into it, for example
cat error.log | claude -p "what's going on here", so it explains an error log. - Using command-line tools you already have, such as
gh: withghinstalled and signed in, Claude can open pull requests and read review comments. - Stopping it mid-action with
Esc, which keeps everything done up to that point and lets you redirect.
The same guide recommends watching the first minute of a task and stepping in as soon as the agent drifts. Previewing changes and debugging with AI help build that habit. If a command is unreadable to you, ask for an explanation in plain language, as described in reading code without coding. For the wider context of this kind of work, read what is vibe coding.
How do I start tomorrow?
- Open the terminal inside your project folder and type
pwdto confirm where you are before asking for any change. - Practice
lsandcdfor ten minutes in a test folder with files that do not matter. Moving around without fear is what lets you read what an agent does. - When an agent proposes a command that deletes or moves, ask first for the read-only version:
lswith the same pattern. - Before letting an agent work on a real project, make sure it has a copy in Git. That way a wrong deletion can be undone.
- If you do not understand a command, do not run it. Ask it to explain and to say which files it would touch.
Example
Illustrative example: a designer asks an agent to clean up the old screenshots in her project. The agent proposes rm screenshots/*.png. Before accepting, she asks it to run ls screenshots/*.png. The list includes final-client-delivery.png, which must not be deleted. She then asks it to delete only the files that start with draft-, and checks the list again with ls screenshots/draft-*.png before confirming. The check takes a minute and prevents losing a file that had no copy.
Common mistakes
- Running
rmwith wildcards without checking which files match. - Using
rm -rorrm -rfwithout knowing exactly which folder will be deleted. - Thinking the terminal is only for programmers.
- Accepting commands you do not understand without asking what they do.
- Forgetting which folder you are in and running the command in the wrong place.
pwdsolves it. - Confusing “move” with “copy”:
mvremoves the original, and if the destination already exists it replaces it. - Assuming a deletion made by the agent can be undone with
/rewind. Checkpoints do not cover what only the terminal touched.
Sources
- Ubuntu, “The Linux command line for beginners” (official tutorial): https://ubuntu.com/tutorials/command-line-for-beginners
- Anthropic, “Best practices for Claude Code” (piping,
gh,Esc,/rewindand the checkpoint limit): https://code.claude.com/docs/en/best-practices - Linux manual,
rm(1)(the-i,-I,-r,-foptions and recovery): https://man7.org/linux/man-pages/man1/rm.1.html - Linux manual,
mv(1)(overwriting,-iand-n): https://man7.org/linux/man-pages/man1/mv.1.html