Kipt

Your prompts and skills, one keystroke away.

Explore

Codex cheat sheet: install, commands, flags, slash commands, config and shortcuts

A one-page Codex cheat sheet: install and update, CLI commands and flags, codex exec options, slash commands, keyboard shortcuts, config keys and file paths.

By the Kipt team · Updated 26 October 2026

This Codex cheat sheet puts the commands you reach for on one page: how to install and update the CLI, the subcommands and flags that matter, codex exec options for scripts, slash commands, keyboard shortcuts, the config.toml keys people set most, and where Codex keeps its files.

Every entry comes from OpenAI's command reference, Codex CLI page and configuration reference, checked on 26 October 2026, when the latest release on github.com/openai/codex was 0.164.0. Codex ships often, so run codex --help or type / in a session to see what your version has.

How do you install and update Codex?

Method Install Update
macOS, Linux script curl -fsSL https://chatgpt.com/codex/install.sh | sh Same command
Windows script powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" Same command
npm npm install -g @openai/codex Same command
Homebrew brew install --cask codex brew upgrade --cask codex
Self-update codex update (when your release supports it)

Then open a project folder and run codex. The first run asks you to sign in; choose Sign in with ChatGPT or another method.

Sign-in task Command
Sign in with a browser codex login
Sign in on a headless machine codex login --device-auth
Save an API key login printenv OPENAI_API_KEY | codex login --with-api-key
Check how you are signed in codex login status (exits 0 when logged in)
Sign out codex logout

Which Codex commands should you know?

Command What it does
codex Start the interactive terminal UI, optionally with a prompt
codex exec (codex e) Run non-interactively; stream text or JSONL
codex review Non-interactive review of changes, a branch diff or a commit
codex resume Continue a saved session; --last for the most recent
codex fork Copy a saved session into a new chat
codex apply (codex a) Apply the latest diff from a Codex cloud chat locally
codex cloud Browse or submit Codex cloud chats from the terminal (experimental)
codex mcp List, add, remove and authenticate MCP servers
codex plugin Install, list and remove plugins
codex features List feature flags and enable or disable them for good
codex doctor Diagnostic report on install, config, auth and runtime
codex completion zsh Print a shell completion script
codex app Open the ChatGPT desktop app
codex sandbox Run any command inside Codex's sandbox
codex archive, codex delete Archive or permanently delete a saved session

Useful one-liners:

codex "explain this codebase"
codex resume --last
codex resume --all
codex review --base main
codex mcp add context7 -- npx -y @upstash/context7-mcp
eval "$(codex completion zsh)"

Which Codex CLI flags matter most?

These apply to codex and, for most of them, to its subcommands too.

Flag Short What it does
--model -m Use a different model for this run
--profile -p Layer $CODEX_HOME/<name>.config.toml on your config
--sandbox -s read-only, workspace-write or danger-full-access
--ask-for-approval -a on-request or never
--approve-for-me Automatic approval review with workspace-write
--dangerously-bypass-approvals-and-sandbox (--yolo) No approvals and no sandbox; hardened environments only
--cd -C Set the working directory
--add-dir Give write access to another folder (repeatable)
--image -i Attach images to the first prompt
--search Live web search instead of the cached default
--oss Use a local provider (Ollama or LM Studio)
--worktree Start in a new managed Git worktree
--config -c Override any config key, for example -c 'model_verbosity="low"'
--enable, --disable Turn a feature flag on or off for this run
--strict-config Error on unknown fields in config.toml

OpenAI's tip: "For low-friction local work, use --sandbox workspace-write --ask-for-approval on-request." And prefer --add-dir over danger-full-access when Codex needs one more folder.

What are the key codex exec options?

codex exec runs a task to completion without the interactive screen. The codex exec guide goes deeper.

Option What it does
PROMPT or - The task; - reads it from stdin
--json Newline-delimited JSON events instead of formatted text
--output-last-message, -o Write the final message to a file
--output-schema JSON Schema for the final response
--ephemeral Do not save session files to disk
--skip-git-repo-check Allow running outside a Git repository
--ignore-user-config Skip $CODEX_HOME/config.toml (auth still loads)
--ignore-rules Skip user and project execpolicy rules
resume --last Continue the most recent exec session
fork <SESSION_ID> Copy a session into a new one
codex exec --json -o summary.md "run the tests and summarize failures"
CODEX_API_KEY=<api-key> codex exec "triage open bug reports"
codex exec resume --last "now fix the failures you found"

Which slash commands do you use every day?

Type / in the composer to open the menu and start typing to filter. While Codex is working, type a slash command and press Tab to queue it for the next turn.

Command What it does
/model Choose the model and reasoning effort
/fast Toggle a Fast service tier when the model offers one
/permissions Change what Codex can do without asking
/plan Switch to plan mode, optionally with a prompt
/goal Set, pause, view or clear a persistent task goal
/review Review your working tree, a branch or a commit
/diff Show the Git diff, including untracked files
/compact Summarize the chat to free context
/status Model, approval policy, writable roots, token usage
/usage Account token usage
/debug-config Config layers and requirements diagnostics
/init Generate an AGENTS.md scaffold
/mention Attach a file to the chat
/skills Browse and use skills
/mcp List MCP tools; add verbose for details
/plugins, /apps, /hooks Manage plugins, connectors and lifecycle hooks
/new, /clear Fresh chat; /clear also clears the terminal
/resume, /fork Reopen a saved chat or branch the current one
/side (/btw) Ephemeral side chat that leaves the main transcript alone
/worktree Continue in a managed Git worktree
/copy, /export Copy the last output, or export the chat as Markdown
/ps, /stop Check or stop background terminals
/keymap, /vim, /theme Remap keys, toggle Vim mode, pick a syntax theme
/statusline, /title Configure footer and terminal title items
/import Import Claude Code or Cursor setup, projects and chats
/quit, /exit Leave the session

What are the Codex keyboard shortcuts?

Key What it does
@ Search for a file and add its path to the prompt
$ Mention a skill
! at line start Run a local shell command under current approval and sandbox settings
Up, Down Restore draft history
Ctrl+R Search prompt history; Enter uses a match, Esc cancels
Ctrl+G Open the prompt in VISUAL or EDITOR
Ctrl+O Copy the latest completed output (same as /copy)
Enter while working Inject new instructions into the current turn
Tab while working Queue a prompt, slash command or shell command for the next turn
Esc, Esc (empty composer) Edit your previous message and fork the chat from there
Ctrl+C Close the session (same as /exit)

Run /keymap to inspect and remap bindings; changes are saved in config.toml.

Which config.toml keys do people set most?

All of these go in ~/.codex/config.toml. The Codex config guide has a full annotated example.

Key Values
model A model your account can use, for example gpt-6.1-sol
model_reasoning_effort Model dependent, such as low, medium, high, xhigh
approval_policy on-request, never or a granular table
sandbox_mode read-only, workspace-write, danger-full-access
default_permissions A permission profile such as :workspace (beta)
web_search cached (default), indexed, live, disabled
review_model Model used by /review
oss_provider ollama or lmstudio
file_opener vscode (default), cursor, windsurf, vscode-insiders, none
project_doc_max_bytes How much AGENTS.md to read (32 KiB default)
history.persistence save-all or none
tui.theme Syntax theme name
[sandbox_workspace_write] writable_roots, network_access
[shell_environment_policy] Which environment variables reach commands
[mcp_servers.<name>] MCP servers: command and args, or url

Note: approval_policy = "untrusted" is retired and can stop Codex from starting, so remove it if an old config has it.

Where does Codex keep its files?

Path What it is
~/.codex/config.toml Your user settings (~/.codex is the default CODEX_HOME)
~/.codex/<name>.config.toml A named profile for --profile
.codex/config.toml Project settings, trusted projects only
/etc/codex/config.toml System defaults on Unix
~/.codex/AGENTS.md Global instructions for every project
AGENTS.md Project instructions, from the repo root down to your folder
$HOME/.agents/skills Your personal skills
.agents/skills Skills checked into a repository
~/.codex/auth.json Saved credentials when using file storage
~/.codex/history.jsonl Session history when persistence is on
$CODEX_HOME/themes Custom .tmTheme syntax themes

The Codex environment variables guide covers CODEX_HOME, CODEX_API_KEY and the rest, and the Codex profiles guide explains named profiles.

How do you review code with Codex?

Task Command
Review in a session /review, then pick a scope
Review uncommitted changes from a script codex review --uncommitted
Review a branch codex review --base main
Review one commit codex review --commit <SHA>
Review a GitHub pull request Comment @codex review
Ask Codex to fix a finding Comment @codex fix the P1 issue

The Codex review guide covers automatic reviews and AGENTS.md review rules.

Keep your own Codex cheat sheet

A cheat sheet covers the tool; the prompts and skills you use with it are yours. Kipt keeps prompts and Agent Skills as Markdown in a private GitHub repo you own, searchable with Cmd+K, and installs every skill into Codex with npx skills add https://github.com/<you>/<repo>.git --all -g. If you also use Claude Code, the Claude Code cheat sheet follows the same layout.

Questions

What are the most useful Codex CLI commands?

Most days you need codex to start the terminal UI, codex resume --last to pick up where you left off, codex exec for scripted runs and codex review for a quick review of your changes. Inside a session, /model, /permissions, /review, /diff, /compact and /status cover most needs.

How do I install or update the Codex CLI?

On macOS and Linux run curl -fsSL https://chatgpt.com/codex/install.sh | sh, which also updates an existing install. You can also use npm install -g @openai/codex or brew install --cask codex. On Windows, run the install.ps1 script from a new PowerShell window.

How do I resume a previous Codex session?

Run codex resume to open the session picker, or codex resume --last to continue the most recent chat from the current folder. Add --all to include sessions from other folders. Inside a running session, /resume opens the same picker.

How do I let Codex run without asking for approval?

Use --sandbox workspace-write --ask-for-approval on-request for low-friction local work, or --approve-for-me to route approvals to an automatic reviewer. --yolo removes approvals and the sandbox entirely, and OpenAI says to use it only inside an externally hardened environment.

Where is the Codex config file?

Your user config is ~/.codex/config.toml, or config.toml inside CODEX_HOME if you set that variable. Trusted projects can add .codex/config.toml, and named profiles live in ~/.codex/<name>.config.toml. Run /debug-config to see which layer set each value.

More in Codex

All guides

Keep your prompts and skills in one place, in your own GitHub. Install every skill with one command.

Get started

Kipt is an independent product, not affiliated with or endorsed by Anthropic, OpenAI, Cursor or GitHub. Claude, ChatGPT, Codex, Cursor and GitHub are trademarks of their owners.