Codex CLI Cheat Sheet

Every OpenAI Codex CLI command, flag and slash command in one sheet: type to filter in real time, click any entry to copy it.

OpenAI Codex CLISynced to 2026-09111+ entries
⌨️TUI Shortcuts & Input Tricks
10 entries
Control
Input tricks (click the on the right to expand usage examples)
Image input
⚡TUI Slash Commands
15 entries
Session control (click the on the right to expand usage examples)
Code & context (click the on the right to expand usage examples)
Account
🖥️CLI Subcommands
26 entries
Core (click the on the right to expand usage examples)
Account (click the on the right to expand usage examples)
Cloud tasks (click the on the right to expand usage examples)
MCP & plugins (click the on the right to expand usage examples)
Manage & diagnostics (click the on the right to expand usage examples)
🚩CLI Global Flags
14 entries
Model & input (click the on the right to expand usage examples)
Permissions & sandbox (click the on the right to expand usage examples)
Environment & config (click the on the right to expand usage examples)
📦exec Non-interactive Flags
10 entries
Input/output (click the on the right to expand usage examples)
Isolation & clean env (click the on the right to expand usage examples)
🔐Approval Modes & Sandbox
12 entries
Approval presets (toggle via /approvals)
Low-level policy values
Official recommendations
📁AGENTS.md Memory System
8 entries
Discovery order
Config keys
⚙️config.toml Settings
16 entries
Config files
Common keys
Environment variables
Session storage

FAQ

What does this Codex CLI cheat sheet cover?

It covers 8 sections with 111+ entries: TUI shortcuts & input tricks, slash commands, CLI subcommands, global flags, exec non-interactive flags, approval modes & sandbox, the AGENTS.md memory system, and config.toml settings.

What's the difference between codex exec and codex?

codex starts an interactive TUI session; codex exec runs non-interactively and streams results to stdout, ideal for scripts and CI. exec supports --json for JSONL events, -o to write the final reply to a file, --output-schema to validate the output structure, and codex exec resume to resume a non-interactive session.

Where should AGENTS.md be placed?

~/.codex/AGENTS.md is the global layer (inherited by all repos); AGENTS.md can be placed layer by layer from the repo root to the current directory — closer to the current directory wins; AGENTS.override.md provides a temporary override. The merge cap defaults to 32 KiB (tunable via project_doc_max_bytes).

What's the difference between the Auto / Read Only / Full Access approval modes?

Auto (default) allows free read/write/exec inside the working directory and asks before going outside or using the network; Read Only is read-only consulting and requires plan approval before changes; Full Access grants full machine access with no further prompts. Use --sandbox and --ask-for-approval for fine-grained control.

Where does the cheat sheet data come from?

Compiled from the official OpenAI docs at developers.openai.com/codex (as of 2026-09); experimental commands (cloud, sandbox, mcp, etc.) follow the official labels. Everything runs as a purely static local lookup.

Related Tools