Codex CLI command reference with core commands, key options, setup methods, and practical workflows
Switch between Core Commands, Key Options, Setup, and Workflow Examples to focus on the commands you need.
Use keyword search to match command names, option notes, and example commands at once.
Copy the command snippet with one click, then run it directly in your terminal.
codexLaunch interactive mode in the current directory.codex "Summarize this repository structure"Start a session with a task-focused prompt.codex exec "Review this PR diff"Run a one-shot review task from the CLI.cat plan.md | codex exec -Read instructions from stdin.codex review --uncommittedReview local changes before committing.codex review --base mainReview changes against main branch.codex resume --lastContinue the latest session quickly.codex resume <SESSION_ID>Resume a specific saved session.codex fork --lastFork the latest session and continue in a new direction.codex fork <SESSION_ID> "Try an alternative implementation"Start a new branch from a specific session.codex apply <TASK_ID>Apply the latest diff for the specified task.codex cloud diff <TASK_ID>Preview the patch before applying it locally.codex cloud listCheck available tasks from Codex Cloud.codex cloud diff <TASK_ID>Preview task diff before applying locally.codex appLaunch (or install then launch) the desktop app.codex app --helpCheck platform support and startup options.codex exec --profile fast "Inspect routing"Run a low-cost analysis task.codex exec --profile deep "Design refactor plan"Use deeper reasoning for architecture tasks.codex exec --sandbox read-only "List potential bugs"Analyze code without changing files.codex exec --sandbox workspace-write "Apply the fix"Allow edits in the current workspace.codex -a on-requestStart interactive mode with request-based approvals.codex exec -a never "Run checks and summarize"Use no-approval policy for scripted runs.codex exec --full-auto "Implement and test this fix"Run with request-based approvals and workspace-write sandbox.codex resume --last --full-autoResume the latest session with the same convenience defaults.codex --search "Check latest framework changes"Start with web search enabled.codex resume --last --searchContinue the latest session with web search.codex -c model="gpt-5-codex"Launch with a specific model override.codex exec -c 'sandbox_permissions=["workspace-write"]' "Explain risk"Override sandbox permissions inline.printenv OPENAI_API_KEY | codex login --with-api-keyLogin non-interactively with environment variable.codex login --device-authStart interactive device authentication.codex mcp add docs -- command --flagRegister a new MCP server command.codex mcp get docsInspect details of a configured MCP server.codex mcp-serverStart Codex in MCP server mode on stdio.codex mcp-server -c model="gpt-5-codex"Launch MCP server mode with a one-off config override.codex features listCheck staged and experimental flags before enabling.codex features enable <feature_name>Enable a feature flag in your local Codex config.codex completion zsh > ~/.zsh/completions/_codexInstall zsh completion manually.codex completion fish > ~/.config/fish/completions/codex.fishInstall fish completion script.codex exec --profile fast --sandbox read-only "Find dead code candidates"Run static analysis without editing files.codex exec --profile fast --sandbox read-only "Map i18n key usage"Inspect translation usage safely.codex exec --profile default --sandbox workspace-write "Implement tooltip improvements"Run a typical implementation task.codex exec --profile default --sandbox workspace-write "Update docs and tests"Apply code and documentation updates together.codex review --uncommittedRun a quick local review pass.codex review --uncommitted --title "before-merge-check"Attach a custom review title.codex exec --json -o result.json "List migration risks"Capture structured events and final summary.codex exec --json "Generate release notes draft"Use JSONL stream in custom tooling.This page consolidates Codex CLI essentials into one searchable reference so you can move from lookup to execution quickly.
It covers Codex CLI basics, major options, setup commands, and reusable workflow examples in a single searchable view.
Examples are templates. Replace placeholder prompts and choose sandbox/approval settings appropriate for your environment.
Review after CLI updates and when your team changes profiles, sandbox policies, or automation scripts.
Yes. Each card has a copy button that copies the command string so you can paste it into your terminal immediately.