MODULE 2.1 / 3 OF 8
Terminal and Codex in practice
Open a training project in Codex and produce a verifiable change.
1Terminal is an entry point
What it is
The terminal is the window where you write commands for the computer. The shell is the program that interprets those commands. Here the terminal examples use Bash on Linux or macOS; on Windows, use a Bash environment via WSL or follow the official installer for Windows. Do not paste Linux commands directly into PowerShell without adaptation.
Why learn
Knowing which environment you are in avoids errors that seem like AI failures. The cd command changes the current folder; pwd shows the location in Bash. You do not need to memorize dozens of commands to get started.
Key concepts
Terminal; shell; current folder; command and response.
In practice
If you open Codex in the Downloads folder, it is not automatically working inside meu-primeiro-projeto. You need to choose the starting folder.
✓ Do it
In Bash, run pwd and then ls. Read the output: first the location, then the files. Do not change anything in this step.
✗ Avoid
Accepting a conclusion without checking the input that supports it.
2Install from the official source
What it is
The official Codex page offers installers for macOS/Linux and specific guidance for Windows. Installing means adding the program to the machine. The installation command downloads and runs an official script; read the source, check the domain and use your own account. Do not run commands received from unknown pages.
Why learn
Installation, login and execution are different steps. A program that is installed still needs authentication. A completed login does not mean you opened the correct folder.
Key concepts
Official source; installation; version; diagnostics.
In practice
After installation, codex --version reports the version recognized by the terminal. If “command not found” appears, reopen the terminal and check the path indicated by the installer.
3Authenticate without spreading secrets
What it is
Run codex login and complete the browser flow to sign in with ChatGPT. If you choose the API, the key must be in the OPENAI_API_KEY variable; pipe it via standard input, without typing it in the command. A .env file alone does not authenticate Codex: some mechanism must load the variable.
Why learn
Pasting the key in examples, messages, or history can expose the account. It is also possible to be authenticated by the wrong method and consume a different modality than expected.
Key concepts
codex login; codex login status; standard input; active account.
In practice
For the API, the documented command is printenv OPENAI_API_KEY | codex login --with-api-key. It sends the value directly to the program instead of displaying the key on the screen.
Sequence to try
- Prepare a training copy.
- Choose a method, complete the login and run codex login status. Record only “ChatGPT” or “API” on the project sheet.
- Record the observed result and the next correction.
4Enter the folder before requesting
What it is
The working folder is the task bench. Create a small area with training files before allowing changes. A README.md describes the purpose for people; AGENTS.md gives operational instructions to the agent. You do not need to open your entire personal folder to experiment.
Why learn
A small scope reduces ambiguity and makes reviewing differences easier. When something goes wrong, it is clear which files should have been affected.
Key concepts
Local scope; README; AGENTS; input files.
In practice
The project contains README.md and entradas/reuniao.txt. The first task is to explain these two files. No access to personal documents or other projects is needed.
✓ Do it
In Bash: mkdir -p ~/projetos/meu-primeiro-projeto. Then cd ~/projetos/meu-primeiro-projeto and start codex.
✗ Avoid
Mix the training copy with private files or production work.
5Do a first reading task
What it is
Start by requesting inspection: list the structure, read instructions and explain pending items. Ask the agent to cite which files it used. After checking, authorize a small, named change, such as creating plano.md with three next steps.
Why learn
Separating diagnosis and change creates a reference for review. You learn the flow without mixing installation, large refactoring, and publishing in a single attempt.
Key concepts
Inspect; plan; change; validate.
In practice
Initial request: “Read AGENTS.md and README.md. Explain the purpose and list what is missing, without editing.” Second request: “Create only plano.md, with three actions and one verification for each.”
6Use permissions and recovery
What it is
The client’s permissions control access to files, network, and execution. Natural‑language instructions guide behavior, but they do not replace technical isolation. Start with permissions restricted to the training folder. Do not teach removing all protections to work around any error.
Why learn
Recovering a change requires knowing what existed before. Git and file copies provide rollback points; they will be practiced later. Read what the command will do before expanding permissions.
Key concepts
Minimum permission; small changes; comparison; rollback point.
In practice
The agent requests external access to consult the documentation. Evaluate this need separately from permissions to delete files or send messages.
Criteria to review your delivery
Use this rubric after the lab. Each line asks for evidence; checking reading does not mean the practice was performed.
| Criterion | Expected evidence | If not passed |
|---|---|---|
| Scope | The delivery matches the objective of this class. | Reduce the task and name a single result. |
| Inputs | You know which files or data were used. | List the sources and remove unrelated material. |
| Execution | The procedure was carried out in the training environment. | Differentiate what was planned from what was done. |
| Verification | A result was compared with a reference. | Open the file or repeat the verifiable query. |
| Secrets | No token, password, or private data was shared. | Review the work copy before any submission. |
| Continuity | Another person can find the next step. | Update README and record a concrete pending item. |
GET HANDS-ON / ~15 MIN OR IN STEPS
First guided project
Use fictional files and a training folder. Practices involving installation, Telegram or VPS may require additional time for registration and configuration.
Bash · Linux or macOS
Read the block before using. Fields like Your Name and usuario@ip-da-vps are examples to adapt; administrative commands belong only to your training environment.
mkdir -p ~/projetos/meu-primeiro-projeto cd ~/projetos/meu-primeiro-projeto pwd codex --version codex login codex login status codex
Ready criterion
Open a training project in Codex and produce a verifiable change. Record the file created, the test run, and the observed result.
Open lab files and modelsCheck what remained
Codex did not find README.md. Is the first step to increase reasoning?
View commented answer
No. Check the current directory, the file name, and the read permission.
If your answer was different, return to the corresponding topic and write the difference in one sentence. The check does not block your study.
Module summary
- Terminal; shell; current folder; command and response.
- Official source; installation; version; diagnostics.
- codex login; codex login status; standard input; active account.
- Local scope; README; AGENTS; input files.
- Inspect; plan; change; validate.
- Minimum permission; small changes; comparison; rollback point.
Consult the source
Tools verified on 20/09/2026; screen names and availability may change.