Codex Command & Configuration Cheat Sheet: Your Go-To Quick Reference
A compiled cheat sheet of Codex commands, flags, and configuration settings from 30+ articles—covering installation, CLI usage, sandbox controls, and...
Ever wasted minutes searching for a Codex command or config key mid-task? After months of juggling messy notes and digging through shell history, one user turned their frustration into a solution: a concise cheat sheet pulling together all essential Codex commands, flags, and configuration settings from over 30 articles. This guide is that cheat sheet—designed to let you look up what you need in seconds, no browser required.
Installation & Login: The Basics
Getting Codex up and running is straightforward with these common methods:
- macOS/Linux:
curl -fsSL https://chatgpt.com/codex/install.sh | sh - Windows:
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" - Cross-platform (Node required):
npm install -g @openai/codex - macOS (Homebrew):
brew install --cask codex
codex login), device authentication (codex login --device-auth), or API key (printenv OPENAI_API_KEY | codex login --with-api-key). Always run codex doctor to check installation health and codex login status to confirm your session.Core CLI Commands & Flags
Codex’s CLI has key subcommands for different tasks:
codex: Launch interactive terminal interface (TUI)codex exec: Run non-interactive task (shortened tocodex e)codex resume: Continue previous interactive sessioncodex fork: Create a new session from an existing onecodex apply: Apply cloud-generated diffs to local files (shortened tocodex a)
--model/-m: Switch models (e.g.,-m gpt-5.5)--sandbox/-s: Set sandbox access level (read-only,workspace-write,danger-full-access)--search: Enable real-time web search
codex exec, useful flags include --json (output JSONL for parsing) and - (read prompt from stdin).Important Notes
Commands and configs may change with Codex versions—always verify with codex --help or codex --version. Experimental features are marked, so use them cautiously.
Sources
- W3C School AI Coding Guide: Codex Cheat Sheet. http://www.w3cschool.cn/aicodingguide/codex-cheatsheet.html