Codex CLI Keyboard Shortcuts
Keyboard shortcuts, approval modes, and slash commands for Codex CLI — OpenAI's open-source terminal coding agent — on MacWindowsLinux. Default keybindings (remappable via /keymap). This is the terminal agent — the IDE extension, the Codex desktop app, and Codex cloud are separate surfaces.
Looking for one specific task? Exit Codex CLI, add a new line, use plan mode, clear the input, or change the model — each has a full guide.
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 |
|---|---|
| Cycle collaboration modes (Plan → Pair → Execute) | ShiftTabShiftTabShiftTab |
| 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.
Is this Codex CLI, the Codex IDE extension, or the Codex app?
This page covers Codex CLI — the terminal agent you start by running codex. OpenAI uses Codex as an umbrella name for four separate surfaces that share your account but not their keys: the CLI (this page), the IDE extension for VS Code, Cursor, and Windsurf, the Codex desktop app, and Codex cloud for delegated background tasks. The shortcuts below apply to the CLI only. If you meant the extension, see the next question — it has almost no default shortcuts.
Does the Codex IDE extension have keyboard shortcuts?
Almost none by default. The extension — published as "Codex – OpenAI's coding agent" — ships a single default binding, Cmd+N or Ctrl+N for a new chat in the sidebar, and even that applies only where the editor reports support for it. Every other Codex command (Open Codex Sidebar, Open Codex Command Menu, New Codex Agent, Implement with Codex, Add to Codex Thread, Add File to Codex Thread) is a Command Palette entry with no key attached. To assign your own: open the Command Palette with Cmd+Shift+P or Ctrl+Shift+P, run Preferences: Open Keyboard Shortcuts, search for Codex, and set a key on the command you want. The Codex desktop app is the opposite — it ships a full keymap of its own.
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.
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.