Starting & Core Keys

Action Shortcut
Install with npm npm install -g @openai/codexnpm install -g @openai/codexnpm install -g @openai/codex
Start the Codex TUI codexcodexcodex
Send the current message EnterEnterEnter
Insert a newline (reliable across terminals) CtrlJCtrlJCtrlJ
Insert a newline (alternate binding) AltEnterAltEnterAltEnter
Interrupt the running task EscEscEsc
Inject instructions into the current turn EnterEnterEnter
Queue follow-up input for the next turn TabTabTab
Edit your previous message (walk back the transcript) EscEscEscEscEscEsc
Exit the interactive session CtrlCCtrlCCtrlC

Editing & View

Action Shortcut
Open the current draft in an external editor CtrlGCtrlGCtrlG
Copy the last agent response to the clipboard CtrlOCtrlOCtrlO
Clear the terminal UI (keeps the conversation) CtrlLCtrlLCtrlL
Open the transcript overlay CtrlTCtrlTCtrlT
Toggle raw scrollback mode (copy-friendly) AltRAltRAltR
Open a side conversation without derailing the task Ctrl/Ctrl/Ctrl/
Toggle the shortcut overlay (cheat sheet) ???
Move to start of line CtrlACtrlACtrlA
Move to end of line CtrlECtrlECtrlE
Jump back one word AltBAltBAltB
Jump forward one word AltFAltFAltF
Delete to start of line CtrlUCtrlUCtrlU
Delete to end of line CtrlKCtrlKCtrlK
Delete the previous word CtrlWCtrlWCtrlW
Paste back what you just deleted CtrlYCtrlYCtrlY

History & Reasoning

Action Shortcut
Reverse-search command history CtrlRCtrlRCtrlR
Next match in reverse search CtrlSCtrlSCtrlS
Raise reasoning effort a step Alt.Alt.Alt.
Lower reasoning effort a step Alt,Alt,Alt,
Raise reasoning effort (alternate binding) ShiftUpShiftUpShiftUp
Lower reasoning effort (alternate binding) ShiftDownShiftDownShiftDown
Edit the most recently queued message ShiftLeftShiftLeftShiftLeft
Edit the most recently queued message (alternate) AltUpAltUpAltUp

Slash Commands

Action Shortcut
Choose the active model and reasoning effort /model/model/model
Set what Codex can do without asking first /permissions/permissions/permissions
Switch to plan mode (optionally with a prompt) /plan/plan/plan
Ask Codex to review your working tree /review/review/review
Show the Git diff (including untracked files) /diff/diff/diff
Clear the terminal and start a fresh chat /clear/clear/clear
Summarize the conversation to free tokens /compact/compact/compact
Copy the latest completed output /copy/copy/copy
Start a new conversation in the same session /new/new/new
Resume a saved conversation /resume/resume/resume
Fork the current conversation into a new thread /fork/fork/fork
Generate an AGENTS.md scaffold /init/init/init
Show session config and token usage /status/status/status
List configured MCP tools /mcp/mcp/mcp
Remap TUI keyboard shortcuts /keymap/keymap/keymap
Toggle Vim mode for the composer /vim/vim/vim
Exit the CLI /quit/quit/quit

File References, Shell & Modes

Action Shortcut
Fuzzy-search and attach a workspace file @@@
Run a local shell command (prefix the line) !command!command!command
Read-only sandbox (browse, no edits) codex --sandbox read-onlycodex --sandbox read-onlycodex --sandbox read-only
Workspace-write sandbox (edit within the project) codex --sandbox workspace-writecodex --sandbox workspace-writecodex --sandbox workspace-write
Bypass all approvals and sandbox (use sparingly) codex --yolocodex --yolocodex --yolo
No shortcuts found. Try a different search term.

Frequently Asked Questions

What is Codex CLI?
Codex CLI is OpenAI's official open-source terminal coding agent (the package @openai/codex), written in Rust. It runs an interactive terminal UI that reads, edits, and runs code in your project, and it's the OpenAI equivalent of Claude Code, Gemini CLI, and Grok Build. Install it with npm (npm install -g @openai/codex), Homebrew, or the official install script, then run codex to launch the TUI.
How do I exit or quit Codex CLI?
Press Ctrl+C to exit the session immediately, or type /quit (or /exit) and press Enter. Note that Esc does not quit — it only interrupts the task Codex is currently running. So Esc to stop a task, Ctrl+C or /quit to leave Codex entirely.
How do I stop Codex while it's running?
Press Esc to interrupt the active task. (Some third-party cheat sheets list F12 for this — that's wrong; F12 only appears in the project's test code. The real default is Esc.) To exit the whole session, press Ctrl+C or type /exit or /quit.
How do I add a new line in Codex CLI without sending?
Press Ctrl+J — it's the reliable newline key across terminals. Shift+Enter and Alt+Enter are also bound, but many terminals can't distinguish Shift+Enter from Enter, so they don't always work. When in doubt, use Ctrl+J.
What is the plan mode shortcut in Codex CLI?
Type /plan and press Enter to switch to plan mode, where Codex maps out its approach before touching your files. You can add a prompt on the same line — /plan refactor the auth module. There is no dedicated key combo for it; the slash command is the switch.
What is the reasoning effort shortcut in Codex CLI?
Alt+. raises the reasoning effort a step and Alt+, lowers it, without leaving the chat. Shift+Up and Shift+Down are bound to the same two actions, so both pairs work — Codex ships the Alt pair as the documented default and keeps the Shift arrows as compatibility bindings (they drop out if you rebind those arrows to something else). Two things to know: stepping up never crosses into the highest effort levels, which need the explicit picker, and the shortcuts do nothing while a popup or modal has focus. /model sets the model and its effort together.
How do I change what Codex is allowed to do?
Use the /permissions slash command to pick a preset: Auto (read, edit, and run commands in the working directory), Read-only (browse only; asks before changes), or Full Access (work across the machine with network — use sparingly). You can also set it at launch with --sandbox read-only | workspace-write | danger-full-access and --ask-for-approval. Older versions used /approvals; current builds use /permissions.
How do I reference files or run shell commands in Codex CLI?
Type @ in the composer to fuzzy-search workspace files, then Tab or Enter to insert the path. To run a shell command, prefix the line with ! (for example !ls) and the output is fed back to Codex, subject to your approval settings.
How is Codex CLI different from ChatGPT?
Codex CLI is a terminal coding agent that edits and runs code in your project from the command line. ChatGPT is OpenAI's web and app chat assistant, covered on the ChatGPT keyboard shortcuts page. They both come from OpenAI but are separate tools with different interfaces and shortcuts.