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.

info Quick Definition
The terminal is a text interface where you type commands that the computer runs, instead of clicking buttons. It is how many AI coding tools read files, run tests and make changes. Knowing the minimum lets you review what they do before you accept it.

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?

CommandWhat it doesExample
pwdShows the folder you are inpwd
lsLists files and folders (ls -a includes hidden ones)ls
cdChanges foldercd projects/site
mkdirCreates a foldermkdir prototypes
cpCopies a filecp logo.svg logo-v2.svg
mvMoves or renamesmv draft.md final.md
rmDeletes a filerm draft.md

According to the Ubuntu tutorial:

  • cd with nothing after it takes you to your home folder.
  • The -p option of mkdir also creates any missing parent folders.
  • To the command line, renaming is moving a file from one name to another, which is why mv does 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”, so rm *.png deletes every PNG in the folder, including the ones you forgot were there.
  • The -r option. It makes rm work recursively: it deletes folders with everything inside.
  • The -f option. 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: with gh installed 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?

  1. Open the terminal inside your project folder and type pwd to confirm where you are before asking for any change.
  2. Practice ls and cd for 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.
  3. When an agent proposes a command that deletes or moves, ask first for the read-only version: ls with the same pattern.
  4. 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.
  5. 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 rm with wildcards without checking which files match.
  • Using rm -r or rm -rf without 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. pwd solves it.
  • Confusing “move” with “copy”: mv removes 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

Frequently asked questions

What is the terminal?
It is a text interface where you type commands that the computer runs and you read its answers as text. Many AI coding tools use it to read files, run tests and make changes.
Which basic commands do I need to know?
pwd to see where you are, ls to see what is there, cd to enter a folder, mkdir to create one, cp to copy, mv to move or rename and rm to delete.
Why is rm dangerous?
Because it does not move files to a trash folder: it deletes them. A wildcard such as * can match more files than you intended, and the -r option also deletes folders with everything inside.
Do I have to use the terminal to work with AI?
Not always, but it is worth understanding. Many tools use it underneath, and knowing how to read its output lets you review what the agent did before you accept it.