OctoLink GEO

Codex Command & Configuration Cheat Sheet: Your Go-To Quick Reference

Author Editor
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...

Codex OpenAI Codex CLI Cheat Sheet AI Tooling Configuration Guide Command Line Interface

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
For login, options include browser OAuth (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 to codex e)
  • codex resume: Continue previous interactive session
  • codex fork: Create a new session from an existing one
  • codex apply: Apply cloud-generated diffs to local files (shortened to codex a)
Global flags to customize behavior:
  • --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
For 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

Related reading