整理 Codex CLI 基本指令、主要選項、設定方式與實用工作流程的參考表
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 --last分支最近的工作階段並改走另一個方向。codex fork <SESSION_ID> "嘗試替代實作"從指定工作階段開啟新的討論分支。codex apply <TASK_ID>套用指定任務的最新差異。codex cloud diff <TASK_ID>先預覽補丁內容再在本機套用。codex cloud list查看 Codex Cloud 的可用任務。codex cloud diff <TASK_ID>在本機套用前先預覽差異內容。codex app啟動應用程式(必要時先安裝再啟動)。codex app --help確認平台支援與啟動選項。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 "實作並測試這個修正"以按需核准與 workspace-write 沙箱執行。codex resume --last --full-auto以相同便利預設延續最近工作階段。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-server在 stdio 啟動 MCP 伺服器模式。codex mcp-server -c model="gpt-5-codex"以一次性設定覆寫啟動。codex features list啟用前先檢查分階段與實驗性旗標。codex features enable <feature_name>在本機 Codex 設定中啟用功能旗標。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.