{"id":163001,"date":"2026-03-20T16:33:41","date_gmt":"2026-03-20T13:33:41","guid":{"rendered":"https:\/\/computingforgeeks.com\/codex-cli-cheat-sheet\/"},"modified":"2026-03-22T03:24:15","modified_gmt":"2026-03-22T00:24:15","slug":"codex-cli-cheat-sheet","status":"publish","type":"post","link":"https:\/\/computingforgeeks.com\/codex-cli-cheat-sheet\/","title":{"rendered":"OpenAI Codex CLI Cheat Sheet &#8211; Commands, Shortcuts, Tips"},"content":{"rendered":"\n<p><a href=\"https:\/\/github.com\/openai\/codex\" target=\"_blank\" rel=\"noreferrer noopener\">Codex CLI<\/a> is OpenAI&#8217;s terminal-based coding agent. Built in Rust, it reads your codebase, edits files, runs commands, and manages git workflows from the command line. Codex runs with OS-native sandboxing (Seatbelt on macOS, Bubblewrap on Linux) to safely execute commands without risking your system. This cheat sheet covers every command, shortcut, configuration option, and workflow pattern for Codex CLI.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1898\" height=\"1190\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2026\/03\/codex-cli-splash.png\" alt=\"OpenAI Codex CLI terminal showing interactive coding session\" class=\"wp-image-163003\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2026\/03\/codex-cli-splash.png 1898w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2026\/03\/codex-cli-splash-300x188.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2026\/03\/codex-cli-splash-1024x642.png 1024w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2026\/03\/codex-cli-splash-768x482.png 768w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2026\/03\/codex-cli-splash-1536x963.png 1536w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2026\/03\/codex-cli-splash-670x420.png 670w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2026\/03\/codex-cli-splash-696x436.png 696w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2026\/03\/codex-cli-splash-1068x670.png 1068w\" sizes=\"auto, (max-width: 1898px) 100vw, 1898px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Installation<\/h2>\n\n\n\n<p>Install Codex CLI via npm, Homebrew, or direct binary download:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># npm (all platforms)\nnpm install -g @openai\/codex\n\n# Homebrew (macOS)\nbrew install --cask codex\n\n# Verify\ncodex --version<\/code><\/pre>\n\n\n\n<p>Authenticate with your ChatGPT account or API key:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Browser-based login (default)\ncodex\n\n# API key login\nprintenv OPENAI_API_KEY | codex login --with-api-key\n\n# Headless\/SSH login\ncodex login --device-auth<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Keyboard Shortcuts<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Shortcut<\/th><th>Action<\/th><\/tr><\/thead><tbody><tr><td><code>Ctrl+C<\/code><\/td><td>Cancel current operation (press twice to quit)<\/td><\/tr><tr><td><code>Ctrl+D<\/code><\/td><td>Exit Codex (press twice to force quit)<\/td><\/tr><tr><td><code>Ctrl+L<\/code><\/td><td>Clear terminal screen<\/td><\/tr><tr><td><code>Ctrl+G<\/code><\/td><td>Open prompt in external editor (vim, etc.)<\/td><\/tr><tr><td><code>Enter<\/code><\/td><td>During execution &#8211; inject new instructions<\/td><\/tr><tr><td><code>Tab<\/code><\/td><td>Queue a follow-up prompt while agent is working<\/td><\/tr><tr><td><code>Esc + Esc<\/code><\/td><td>Edit your previous message (when composer is empty)<\/td><\/tr><tr><td><code>Esc<\/code><\/td><td>Close navigation drawer<\/td><\/tr><tr><td><code>Up\/Down<\/code><\/td><td>Navigate draft history<\/td><\/tr><tr><td><code>@<\/code><\/td><td>Fuzzy file search &#8211; attach files to conversation<\/td><\/tr><tr><td><code>!<\/code><\/td><td>Execute local shell command directly<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Slash Commands<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Session Management<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Command<\/th><th>What It Does<\/th><\/tr><\/thead><tbody><tr><td><code>\/clear<\/code><\/td><td>Reset UI and conversation<\/td><\/tr><tr><td><code>\/compact<\/code><\/td><td>Summarize conversation to free token space<\/td><\/tr><tr><td><code>\/new<\/code><\/td><td>Start fresh conversation in same session<\/td><\/tr><tr><td><code>\/resume<\/code><\/td><td>Resume a saved conversation<\/td><\/tr><tr><td><code>\/fork<\/code><\/td><td>Clone current conversation to new thread<\/td><\/tr><tr><td><code>\/copy<\/code><\/td><td>Copy latest Codex output to clipboard<\/td><\/tr><tr><td><code>\/diff<\/code><\/td><td>Display git diff including untracked files<\/td><\/tr><tr><td><code>\/status<\/code><\/td><td>Show session config and token usage<\/td><\/tr><tr><td><code>\/exit<\/code> \/ <code>\/quit<\/code><\/td><td>Exit Codex CLI<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Configuration and Model<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Command<\/th><th>What It Does<\/th><\/tr><\/thead><tbody><tr><td><code>\/model<\/code><\/td><td>Choose model and reasoning effort level<\/td><\/tr><tr><td><code>\/fast<\/code><\/td><td>Toggle fast mode for GPT-5.4<\/td><\/tr><tr><td><code>\/permissions<\/code><\/td><td>Set what Codex can do without asking<\/td><\/tr><tr><td><code>\/theme<\/code><\/td><td>Choose syntax highlighting theme<\/td><\/tr><tr><td><code>\/personality<\/code><\/td><td>Set communication style: friendly, pragmatic, or none<\/td><\/tr><tr><td><code>\/statusline<\/code><\/td><td>Configure footer status bar items<\/td><\/tr><tr><td><code>\/experimental<\/code><\/td><td>Toggle experimental features<\/td><\/tr><tr><td><code>\/debug-config<\/code><\/td><td>Print config layer diagnostics<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Code and Project Tools<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Command<\/th><th>What It Does<\/th><\/tr><\/thead><tbody><tr><td><code>\/init<\/code><\/td><td>Generate AGENTS.md scaffold with project context<\/td><\/tr><tr><td><code>\/review<\/code><\/td><td>Code review of working tree changes<\/td><\/tr><tr><td><code>\/plan<\/code><\/td><td>Switch to plan mode (read-only exploration)<\/td><\/tr><tr><td><code>\/mention<\/code><\/td><td>Attach files to conversation<\/td><\/tr><tr><td><code>\/mcp<\/code><\/td><td>List configured MCP tools<\/td><\/tr><tr><td><code>\/agent<\/code><\/td><td>Switch active agent thread<\/td><\/tr><tr><td><code>\/ps<\/code><\/td><td>Show background terminals and output<\/td><\/tr><tr><td><code>\/feedback<\/code><\/td><td>Submit logs to maintainers<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">CLI Subcommands<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Command<\/th><th>What It Does<\/th><\/tr><\/thead><tbody><tr><td><code>codex<\/code><\/td><td>Start interactive TUI session<\/td><\/tr><tr><td><code>codex exec<\/code> \/ <code>codex e<\/code><\/td><td>Non-interactive mode (like <code>claude -p<\/code>)<\/td><\/tr><tr><td><code>codex review<\/code><\/td><td>Non-interactive code review<\/td><\/tr><tr><td><code>codex resume<\/code><\/td><td>Resume a previous session<\/td><\/tr><tr><td><code>codex fork<\/code><\/td><td>Fork a previous session into new thread<\/td><\/tr><tr><td><code>codex apply<\/code> \/ <code>codex a<\/code><\/td><td>Apply latest diff as <code>git apply<\/code><\/td><\/tr><tr><td><code>codex login<\/code><\/td><td>Manage authentication<\/td><\/tr><tr><td><code>codex mcp<\/code><\/td><td>Manage MCP servers<\/td><\/tr><tr><td><code>codex mcp-server<\/code><\/td><td>Run Codex as an MCP server (stdio)<\/td><\/tr><tr><td><code>codex sandbox<\/code><\/td><td>Run commands within Codex sandbox<\/td><\/tr><tr><td><code>codex features list<\/code><\/td><td>List all feature flags<\/td><\/tr><tr><td><code>codex cloud<\/code><\/td><td>Browse and apply Codex Cloud tasks<\/td><\/tr><tr><td><code>codex app<\/code><\/td><td>Launch desktop app (macOS)<\/td><\/tr><tr><td><code>codex completion bash<\/code><\/td><td>Generate shell completions<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">CLI Flags Reference<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Core Flags<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Flag<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>-m, --model &lt;MODEL&gt;<\/code><\/td><td>Set model (gpt-5.4, gpt-5.4-mini, gpt-5.3-codex)<\/td><\/tr><tr><td><code>-i, --image &lt;FILE&gt;<\/code><\/td><td>Attach image(s) to initial prompt<\/td><\/tr><tr><td><code>-C, --cd &lt;DIR&gt;<\/code><\/td><td>Set working root directory<\/td><\/tr><tr><td><code>--add-dir &lt;DIR&gt;<\/code><\/td><td>Add writable directories<\/td><\/tr><tr><td><code>-p, --profile &lt;NAME&gt;<\/code><\/td><td>Use named config profile<\/td><\/tr><tr><td><code>--search<\/code><\/td><td>Enable live web search<\/td><\/tr><tr><td><code>--oss<\/code><\/td><td>Use local open-source model (LM Studio\/Ollama)<\/td><\/tr><tr><td><code>-c, --config &lt;key=value&gt;<\/code><\/td><td>Override config.toml values<\/td><\/tr><tr><td><code>--version<\/code><\/td><td>Show version number<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Security and Approval Flags<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Flag<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>-s, --sandbox &lt;MODE&gt;<\/code><\/td><td>Sandbox: read-only, workspace-write, danger-full-access<\/td><\/tr><tr><td><code>-a, --ask-for-approval &lt;MODE&gt;<\/code><\/td><td>Approval: untrusted, on-request, never<\/td><\/tr><tr><td><code>--full-auto<\/code><\/td><td>Auto-approve within sandbox (on-request + workspace-write)<\/td><\/tr><tr><td><code>--yolo<\/code><\/td><td>No sandbox, no approvals (dangerous)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Non-Interactive (codex exec) Flags<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Run a task non-interactively\ncodex exec \"fix the failing tests\"\n\n# Output JSON for scripting\ncodex exec --json \"list all API endpoints\"\n\n# Save final response to file\ncodex exec -o result.txt \"summarize the architecture\"\n\n# Enforce JSON schema on output\ncodex exec --output-schema schema.json \"extract metadata\"\n\n# Resume previous session with follow-up\ncodex exec resume --last \"now add error handling\"\n\n# Full-auto mode in CI\/CD\ncodex exec --full-auto \"run tests and fix failures\"\n\n# Set spending budget\ncodex exec --full-auto --config model=gpt-5.4-mini \"fix linting errors\"<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Sandbox Modes<\/h2>\n\n\n\n<p>Codex uses OS-native sandboxing &#8211; Seatbelt on macOS, Bubblewrap on Linux, restricted tokens on Windows:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Mode<\/th><th>File Access<\/th><th>Network<\/th><th>Use Case<\/th><\/tr><\/thead><tbody><tr><td><strong>read-only<\/strong><\/td><td>Read anywhere, no writes<\/td><td>Disabled<\/td><td>Safe exploration, code review<\/td><\/tr><tr><td><strong>workspace-write<\/strong><\/td><td>Read\/write in project dir<\/td><td>Disabled<\/td><td>Normal coding (default for git repos)<\/td><\/tr><tr><td><strong>danger-full-access<\/strong><\/td><td>Full filesystem access<\/td><td>Enabled<\/td><td>System admin tasks (use with caution)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Approval Policies<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Policy<\/th><th>Behavior<\/th><\/tr><\/thead><tbody><tr><td><strong>untrusted<\/strong><\/td><td>Only known-safe read commands auto-approved, everything else prompts<\/td><\/tr><tr><td><strong>on-request<\/strong><\/td><td>Model decides when to ask (default with &#8211;full-auto)<\/td><\/tr><tr><td><strong>never<\/strong><\/td><td>Never asks &#8211; failures returned to model silently<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Common combinations:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Safe exploration (read-only, always ask)\ncodex -s read-only -a untrusted\n\n# Normal coding (default for git projects)\ncodex -s workspace-write -a untrusted\n\n# Full auto (shortcut for workspace-write + on-request)\ncodex --full-auto\n\n# No safety rails (dangerous)\ncodex --yolo<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Models and Reasoning<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Model<\/th><th>Best For<\/th><th>Speed<\/th><\/tr><\/thead><tbody><tr><td><strong>gpt-5.4<\/strong><\/td><td>Complex reasoning, architecture, multi-file changes<\/td><td>Slower<\/td><\/tr><tr><td><strong>gpt-5.4-mini<\/strong><\/td><td>Quick edits, simple tasks, lower cost<\/td><td>Fast<\/td><\/tr><tr><td><strong>gpt-5.3-codex<\/strong><\/td><td>Specialized coding tasks<\/td><td>Medium<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Reasoning effort levels control how deeply the model thinks:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Level<\/th><th>Use Case<\/th><\/tr><\/thead><tbody><tr><td><code>minimal<\/code><\/td><td>Trivial lookups<\/td><\/tr><tr><td><code>low<\/code><\/td><td>Simple questions, quick fixes<\/td><\/tr><tr><td><code>medium<\/code><\/td><td>Default &#8211; balanced<\/td><\/tr><tr><td><code>high<\/code><\/td><td>Complex debugging, architecture<\/td><\/tr><tr><td><code>xhigh<\/code><\/td><td>Hardest problems<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Switch with <code>\/model<\/code> in interactive mode or <code>-m gpt-5.4-mini<\/code> on the command line.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">AGENTS.md &#8211; Project Instructions<\/h2>\n\n\n\n<p>AGENTS.md is Codex&#8217;s equivalent of Claude Code&#8217;s CLAUDE.md. It provides project-specific instructions loaded at the start of every session.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vi AGENTS.md<\/code><\/pre>\n\n\n\n<p>Example project instructions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># My Project\n\n## Build Commands\n- Test: `npm test`\n- Build: `npm run build`\n- Lint: `npm run lint -- --fix`\n\n## Rules\n- Use TypeScript strict mode for all new files\n- Write unit tests for every new function\n- Never commit directly to main branch\n- All API endpoints must have OpenAPI docs<\/code><\/pre>\n\n\n\n<p>Generate one automatically with <code>\/init<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Configuration (config.toml)<\/h2>\n\n\n\n<p>Codex uses TOML config files. Precedence (highest to lowest): CLI flags, profile values, project config (<code>.codex\/config.toml<\/code>), user config (<code>~\/.codex\/config.toml<\/code>), system config (<code>\/etc\/codex\/config.toml<\/code>), defaults.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vi ~\/.codex\/config.toml<\/code><\/pre>\n\n\n\n<p>Common settings:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Model and reasoning\nmodel = \"gpt-5.4\"\nmodel_reasoning_effort = \"high\"\n\n# Security defaults\nsandbox_mode = \"workspace-write\"\napproval_policy = \"on-request\"\n\n# Personality\npersonality = \"pragmatic\"\n\n# Web search\nweb_search = \"cached\"\n\n# Performance\nservice_tier = \"fast\"\n\n# Developer instructions (like AGENTS.md but in config)\ndeveloper_instructions = \"Always use TypeScript. Prefer functional patterns.\"\n\n# MCP servers\n[mcp_servers.github]\ncommand = [\"npx\", \"-y\", \"@modelcontextprotocol\/server-github\"]\n\n# Named profiles\n[profiles.fast]\nmodel = \"gpt-5.4-mini\"\nmodel_reasoning_effort = \"low\"\nservice_tier = \"fast\"\n\n[profiles.thorough]\nmodel = \"gpt-5.4\"\nmodel_reasoning_effort = \"xhigh\"<\/code><\/pre>\n\n\n\n<p>Use profiles with <code>codex -p fast<\/code> or <code>codex -p thorough<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">MCP Servers<\/h2>\n\n\n\n<p>Codex supports <a href=\"https:\/\/modelcontextprotocol.io\/\" target=\"_blank\" rel=\"noreferrer noopener\">MCP<\/a> for connecting to external tools. Configure in <code>~\/.codex\/config.toml<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># STDIO transport (local process)\n[mcp_servers.github]\ncommand = [\"npx\", \"-y\", \"@modelcontextprotocol\/server-github\"]\nenabled = true\nstartup_timeout_sec = 30\n\n# HTTP transport (remote server)\n[mcp_servers.remote-db]\nurl = \"https:\/\/my-mcp-server.example.com\"<\/code><\/pre>\n\n\n\n<p>Codex can also run as an MCP server itself:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>codex mcp-server<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Skills System<\/h2>\n\n\n\n<p>Skills extend Codex with reusable task-specific capabilities. They are scanned from multiple locations:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>.agents\/skills\/<\/code> &#8211; project-level (checked into git)<\/li>\n\n\n\n<li><code>~\/.codex\/skills\/<\/code> or <code>~\/.agents\/skills\/<\/code> &#8211; personal<\/li>\n\n\n\n<li><code>\/etc\/codex\/skills\/<\/code> &#8211; system-wide<\/li>\n<\/ul>\n\n\n\n<p>Invoke skills with <code>$skill-name<\/code> in the composer, or create new ones with <code>$skill-creator<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Execution Policy Rules<\/h2>\n\n\n\n<p>Define fine-grained rules for what commands Codex can run. Rules use Starlark format in <code>~\/.codex\/rules\/<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vi ~\/.codex\/rules\/default.rules<\/code><\/pre>\n\n\n\n<p>Example rules:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>prefix_rule(\n    pattern = [\"git\", \"push\"],\n    decision = \"forbidden\",\n    justification = \"No direct pushes - use PR workflow\"\n)\n\nprefix_rule(\n    pattern = [\"rm\", \"-rf\"],\n    decision = \"prompt\",\n    justification = \"Destructive operation needs confirmation\"\n)<\/code><\/pre>\n\n\n\n<p>Test rules before applying:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>codex execpolicy check --pretty -- git push origin main<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Environment Variables<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Variable<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>CODEX_HOME<\/code><\/td><td>Override config directory (default: <code>~\/.codex<\/code>)<\/td><\/tr><tr><td><code>CODEX_API_KEY<\/code><\/td><td>API key for non-interactive\/CI use<\/td><\/tr><tr><td><code>OPENAI_API_KEY<\/code><\/td><td>OpenAI API key (alternative)<\/td><\/tr><tr><td><code>CODEX_CA_CERTIFICATE<\/code><\/td><td>Custom CA cert for corporate proxies<\/td><\/tr><tr><td><code>CODEX_THREAD_ID<\/code><\/td><td>Current thread ID (injected into subprocesses)<\/td><\/tr><tr><td><code>HTTPS_PROXY<\/code><\/td><td>HTTP proxy for corporate networks<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Non-Interactive Code Review<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># Review uncommitted changes\ncodex review --uncommitted\n\n# Review against a branch\ncodex review --base main\n\n# Review a specific commit\ncodex review --commit abc123<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">File Structure Reference<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># User-level (personal, all projects)\n~\/.codex\/\n  config.toml            # Global settings\n  auth.json              # Stored credentials\n  rules\/                 # Execution policy rules\n  skills\/                # Personal skills\n  themes\/                # Custom .tmTheme files\n  log\/                   # Debug logs\n\n# Project-level (shared with team)\n.codex\/\n  config.toml            # Project settings (trusted projects only)\nAGENTS.md                # Project instructions\n.agents\/\n  skills\/                # Project skills<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Codex CLI vs Claude Code<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Feature<\/th><th>Codex CLI<\/th><th>Claude Code<\/th><\/tr><\/thead><tbody><tr><td>Language<\/td><td>Rust<\/td><td>TypeScript<\/td><\/tr><tr><td>Models<\/td><td>GPT-5 family + local OSS<\/td><td>Claude family (Opus, Sonnet, Haiku)<\/td><\/tr><tr><td>Sandbox<\/td><td>OS-native (Seatbelt, Bubblewrap)<\/td><td>Config-based<\/td><\/tr><tr><td>Project config<\/td><td>AGENTS.md + config.toml<\/td><td>CLAUDE.md + settings.json<\/td><\/tr><tr><td>Non-interactive<\/td><td><code>codex exec<\/code><\/td><td><code>claude -p<\/code><\/td><\/tr><tr><td>Code review<\/td><td>Built-in <code>codex review<\/code><\/td><td>Via prompt<\/td><\/tr><tr><td>Web search<\/td><td>Built-in (cached\/live)<\/td><td>Via MCP<\/td><\/tr><tr><td>Pricing<\/td><td>ChatGPT Plus ($20\/mo) or API<\/td><td>Claude Pro ($20\/mo) or API<\/td><\/tr><tr><td>Multi-agent<\/td><td>Built-in thread spawning<\/td><td>Subagent tool<\/td><\/tr><tr><td>Execution policy<\/td><td>Starlark rules files<\/td><td>Not available<\/td><\/tr><tr><td>Local models<\/td><td>LM Studio, Ollama<\/td><td>Not supported<\/td><\/tr><tr><td>MCP<\/td><td>Client and server<\/td><td>Client only<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>For multi-provider support beyond OpenAI, consider <a href=\"https:\/\/computingforgeeks.com\/setup-opencode-ai-coding-agent\/\" target=\"_blank\" rel=\"noreferrer noopener\">OpenCode<\/a> which supports 75+ providers, or <a href=\"https:\/\/computingforgeeks.com\/setup-aider-ai-pair-programming\/\" target=\"_blank\" rel=\"noreferrer noopener\">Aider<\/a> which excels at git-native workflows with automatic commits for every change.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Practical Workflow Tips<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Start Every Project Right<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>codex\n\/init<\/code><\/pre>\n\n\n\n<p>This generates an AGENTS.md with your project&#8217;s build commands, test setup, and conventions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Use Profiles for Different Workflows<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Quick fix - fast model, low reasoning\ncodex -p fast \"fix the typo in README\"\n\n# Deep architecture work - powerful model, max reasoning\ncodex -p thorough \"redesign the auth module\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">CI\/CD Integration<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Fix failing tests automatically\ncodex exec --full-auto \"run tests and fix all failures\"\n\n# Code review in CI\ncodex review --base main --json > review-results.json\n\n# Generate documentation\ncodex exec -o docs\/api.md \"generate API documentation from the source code\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Image Input<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Analyze a screenshot\ncodex -i screenshot.png \"what's wrong with this UI?\"\n\n# Multiple images\ncodex -i before.png,after.png \"compare these two designs\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Local Models (No API Key Needed)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Use with LM Studio\ncodex --oss --local-provider lmstudio\n\n# Use with Ollama\ncodex --oss --local-provider ollama<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Quick Reference Card<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Action<\/th><th>How<\/th><\/tr><\/thead><tbody><tr><td>Start session<\/td><td><code>codex<\/code><\/td><\/tr><tr><td>Start with prompt<\/td><td><code>codex \"fix the auth bug\"<\/code><\/td><\/tr><tr><td>Non-interactive<\/td><td><code>codex exec \"query\"<\/code><\/td><\/tr><tr><td>Resume session<\/td><td><code>codex resume<\/code><\/td><\/tr><tr><td>Full auto mode<\/td><td><code>codex --full-auto<\/code><\/td><\/tr><tr><td>Switch model<\/td><td><code>\/model<\/code><\/td><\/tr><tr><td>Plan mode<\/td><td><code>\/plan<\/code><\/td><\/tr><tr><td>Code review<\/td><td><code>codex review --base main<\/code><\/td><\/tr><tr><td>Clear context<\/td><td><code>\/clear<\/code><\/td><\/tr><tr><td>Compact context<\/td><td><code>\/compact<\/code><\/td><\/tr><tr><td>View diff<\/td><td><code>\/diff<\/code><\/td><\/tr><tr><td>Check status<\/td><td><code>\/status<\/code><\/td><\/tr><tr><td>File mention<\/td><td><code>@path\/to\/file<\/code><\/td><\/tr><tr><td>Shell command<\/td><td><code>!ls -la<\/code><\/td><\/tr><tr><td>Cancel<\/td><td><code>Ctrl+C<\/code><\/td><\/tr><tr><td>Exit<\/td><td><code>Ctrl+D<\/code><\/td><\/tr><tr><td>Apply last diff<\/td><td><code>codex apply<\/code><\/td><\/tr><tr><td>Web search<\/td><td><code>codex --search<\/code><\/td><\/tr><tr><td>Local model<\/td><td><code>codex --oss<\/code><\/td><\/tr><tr><td>Use profile<\/td><td><code>codex -p fast<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Codex CLI brings OpenAI&#8217;s coding capabilities directly to the terminal with strong sandboxing defaults and flexible configuration. The key patterns: use AGENTS.md for project context, config profiles for different workflows, <code>codex exec<\/code> for automation, and the built-in sandbox to keep your system safe. For the latest features, check the <a href=\"https:\/\/github.com\/openai\/codex\" target=\"_blank\" rel=\"noreferrer noopener\">official Codex CLI repository<\/a> and <a href=\"https:\/\/openai.com\/index\/introducing-codex\/\" target=\"_blank\" rel=\"noreferrer noopener\">OpenAI&#8217;s documentation<\/a>.<\/p>\n\n\n\n<p>Related guides:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/computingforgeeks.com\/claude-code-cheat-sheet\/\" target=\"_blank\" rel=\"noreferrer noopener\">Claude Code Cheat Sheet &#8211; Commands, Shortcuts, Tips<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/computingforgeeks.com\/ssh-commands-cheat-sheet-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\">SSH Commands Cheat Sheet for Linux SysAdmins<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/computingforgeeks.com\/rsync-command-linux-examples\/\" target=\"_blank\" rel=\"noreferrer noopener\">rsync Command on Linux &#8211; Usage Guide with Examples<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/computingforgeeks.com\/basic-linux-terminal-shortcuts-cheat-sheet\/\" target=\"_blank\" rel=\"noreferrer noopener\">Basic Linux Terminal Shortcuts Cheat Sheet<\/a><\/li>\n<\/ul>\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>Codex CLI is OpenAI&#8217;s terminal-based coding agent. Built in Rust, it reads your codebase, edits files, runs commands, and manages git workflows from the command line. Codex runs with OS-native sandboxing (Seatbelt on macOS, Bubblewrap on Linux) to safely execute commands without risking your system. This cheat sheet covers every command, shortcut, configuration option, and &#8230; <a title=\"OpenAI Codex CLI Cheat Sheet &#8211; Commands, Shortcuts, Tips\" class=\"read-more\" href=\"https:\/\/computingforgeeks.com\/codex-cli-cheat-sheet\/\" aria-label=\"Read more about OpenAI Codex CLI Cheat Sheet &#8211; Commands, Shortcuts, Tips\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":163002,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39034,330,690,5,299,47,50],"tags":[],"class_list":["post-163001","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","category-cheat-sheets","category-dev","category-featured","category-how-to","category-linux","category-linux-tutorials"],"_links":{"self":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/163001","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/comments?post=163001"}],"version-history":[{"count":4,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/163001\/revisions"}],"predecessor-version":[{"id":163453,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/163001\/revisions\/163453"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media\/163002"}],"wp:attachment":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media?parent=163001"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/categories?post=163001"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/tags?post=163001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}