Every Codex Keyboard Shortcut, Explained

A complete Codex keyboard shortcut reference for the terminal TUI, desktop app, input editing, session control, mode switching, background tasks, and failure cases.

What this covers

This is a practical keyboard reference for Codex: terminal CLI/TUI, desktop input behavior, task control, history, mode switching, and terminal compatibility.

Version note: Codex changes quickly. In a live Codex session, press ? first and trust the help shown by your installed build. This guide is written against the 2026-05-22 Codex CLI 0.125.x / Codex desktop workflow.

Who this is for

  • Developers who already run codex and want to stop editing long prompts one character at a time.
  • Teams writing an internal Codex onboarding guide.
  • Users switching between terminal Codex and the desktop app.
  • Anyone whose shortcuts behave differently in iTerm2, Apple Terminal, VS Code terminal, Warp, or tmux.

Shortcut map

ShortcutMeaning
?Show active shortcut help
Ctrl + CCancel input or stop/exit
Ctrl + DExit on empty input
EscInterrupt current response/tool call
Ctrl + LClear/redraw terminal
Shift + TabCycle approval/automation mode
Ctrl + AStart of line
Ctrl + EEnd of line
Ctrl + BBack one character
Ctrl + FForward one character
Option + B / Alt + BBack one word
Option + F / Alt + FForward one word
Ctrl + UDelete before cursor
Ctrl + KDelete after cursor
Ctrl + WDelete previous word
Ctrl + YYank deleted text
TabComplete command/path/menu item
Up / DownNavigate history or menu
Shift + EnterInsert newline, terminal-dependent
Cmd + V / Ctrl + Shift + VPaste multiline prompt

Session control

ShortcutDetail
?The first key to remember. It shows what your build and terminal actually support.
Ctrl + CCancels input, requests a running task stop, and can exit from an empty prompt.
Ctrl + DExits when the input box is empty.
EscInterrupts the current model turn or tool call.
Ctrl + LRedraws the terminal without clearing Codex context.

Important: Esc stops the current turn; it does not revert file edits. Ctrl + C cancels or exits; it also does not roll back files. Ask Codex to revert explicitly or inspect git diff.

Approval and automation modes

ShortcutMeaning
Shift + TabCycle through planning, ask, automatic, and higher-permission modes when available.
ModeExplanation
Plan / Read-onlyAnalyze without editing files.
Default / AskAsk before writes or sensitive commands.
Auto / Workspace-writeLet Codex edit in the workspace while respecting configured boundaries.
Full auto / DangerHigh automation; use only in disposable or isolated environments.

Mnemonic: Plan first, Ask for unknown repos, Auto for repetitive edits, Danger only in a sandbox.

Input editing

Codex usually follows readline/Emacs-style editing in the prompt box. Terminal support varies, but these are the high-value keys.

ShortcutMeaning
Ctrl + AMove to start of line
Ctrl + EMove to end of line
Ctrl + BMove left one character
Ctrl + FMove right one character
Option + B / Alt + BMove back one word
Option + F / Alt + FMove forward one word
Ctrl + UDelete everything before cursor
Ctrl + KDelete everything after cursor
Ctrl + WDelete previous word
Ctrl + YYank deleted text back
Ctrl + H / BackspaceDelete previous character
Ctrl + DDelete under cursor; exit if input is empty

Multiline input

ActionNote
Shift + EnterCommon newline shortcut, but terminal-dependent.
Paste multilineDraft the task in an editor, then paste it.
File-based specPut a long spec in TASK.md and ask Codex to read it.

If Shift + Enter fails, check terminal keybindings, tmux xterm-keys, VS Code terminal skip-shell settings, and whether Warp or another terminal app intercepts the key.

ShortcutMeaning
TabComplete slash commands, paths, or menu items
UpPrevious input or move menu selection up
DownNext input or move menu selection down
EnterSubmit or confirm selection
EscClose menu or interrupt action

For long requirements, avoid relying on input history. Store the spec in a file and ask Codex to read it.

Desktop habits

ShortcutMeaning
Cmd + VPaste prompts, logs, or notes
Cmd + ASelect current input text
Cmd + ZUndo text edits in the input box
Cmd + FSearch in the focused browser/document view
Cmd + WClose the focused window/view

The main desktop trap is focus. The same key behaves differently when focus is in the browser, terminal, editor, or chat input.

The 12 to memorize

ScenarioShortcut
Help?
Stop a drifting runEsc
ExitCtrl + D
Redraw screenCtrl + L
Switch modeShift + Tab
Start of lineCtrl + A
End of lineCtrl + E
Delete before cursorCtrl + U
Delete after cursorCtrl + K
Delete wordCtrl + W
CompleteTab
Previous promptUp

When shortcuts fail

SymptomCauseFix
Option + B/F prints odd charactersOption is not sending MetaEnable Esc+ or Meta in terminal settings
Shift + Enter submitsTerminal does not pass newline comboUse pasted multiline specs or configure terminal keys
Ctrl + S freezes outputTerminal flow control paused outputPress Ctrl + Q; consider stty -ixon
Tab does not completeFocus or menu state mismatchRefocus input, press Esc, retry
Cmd shortcuts do nothingPure terminal does not receive app shortcutsUse terminal Ctrl / Alt equivalents

Difference from Claude Code

Codex and Claude Code share many readline-style keys, but their product-level shortcuts and slash commands differ. Do not assume Claude Code-specific habits such as /terminal-setup, Esc Esc, or Ctrl + T exist in Codex. Use ? as the source of truth.

FAQ

Q: Do Codex and Claude Code share the same keyboard shortcuts? A: Many readline-style keys are the same (Ctrl+A, Ctrl+E, Ctrl+R), but product-level shortcuts and slash commands diverge. Claude Code-specific moves like Esc Esc or /terminal-setup don’t exist in Codex. Press ? in a live session for the authoritative list.

Q: How do I enter multiline prompts in Codex? A: Use the documented multiline trigger from the ? help — typically \ + Enter to insert a newline without sending. Plain Enter submits the prompt. Avoid pasting from a text editor that converts newlines weirdly.

Q: Why does Ctrl+C behave differently in Codex vs my shell? A: In an active Codex session, Ctrl+C usually cancels the in-flight task rather than killing the process. Two presses are sometimes required to exit fully. Behavior varies by terminal — Warp and tmux can intercept signals before Codex sees them.

Q: Which terminals are most likely to break Codex shortcuts? A: tmux, screen, and some VS Code integrated-terminal versions remap meta and alt keys. iTerm2 and Apple Terminal work cleanly once you enable “Use Option as Meta key”. When in doubt, test in plain Terminal.app first.

Tags: #AI coding #Codex #Tutorial