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
codexand 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
| Shortcut | Meaning |
|---|---|
? | Show active shortcut help |
Ctrl + C | Cancel input or stop/exit |
Ctrl + D | Exit on empty input |
Esc | Interrupt current response/tool call |
Ctrl + L | Clear/redraw terminal |
Shift + Tab | Cycle approval/automation mode |
Ctrl + A | Start of line |
Ctrl + E | End of line |
Ctrl + B | Back one character |
Ctrl + F | Forward one character |
Option + B / Alt + B | Back one word |
Option + F / Alt + F | Forward one word |
Ctrl + U | Delete before cursor |
Ctrl + K | Delete after cursor |
Ctrl + W | Delete previous word |
Ctrl + Y | Yank deleted text |
Tab | Complete command/path/menu item |
Up / Down | Navigate history or menu |
Shift + Enter | Insert newline, terminal-dependent |
Cmd + V / Ctrl + Shift + V | Paste multiline prompt |
Session control
| Shortcut | Detail |
|---|---|
? | The first key to remember. It shows what your build and terminal actually support. |
Ctrl + C | Cancels input, requests a running task stop, and can exit from an empty prompt. |
Ctrl + D | Exits when the input box is empty. |
Esc | Interrupts the current model turn or tool call. |
Ctrl + L | Redraws 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
| Shortcut | Meaning |
|---|---|
Shift + Tab | Cycle through planning, ask, automatic, and higher-permission modes when available. |
| Mode | Explanation |
|---|---|
| Plan / Read-only | Analyze without editing files. |
| Default / Ask | Ask before writes or sensitive commands. |
| Auto / Workspace-write | Let Codex edit in the workspace while respecting configured boundaries. |
| Full auto / Danger | High 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.
| Shortcut | Meaning |
|---|---|
Ctrl + A | Move to start of line |
Ctrl + E | Move to end of line |
Ctrl + B | Move left one character |
Ctrl + F | Move right one character |
Option + B / Alt + B | Move back one word |
Option + F / Alt + F | Move forward one word |
Ctrl + U | Delete everything before cursor |
Ctrl + K | Delete everything after cursor |
Ctrl + W | Delete previous word |
Ctrl + Y | Yank deleted text back |
Ctrl + H / Backspace | Delete previous character |
Ctrl + D | Delete under cursor; exit if input is empty |
Multiline input
| Action | Note |
|---|---|
Shift + Enter | Common newline shortcut, but terminal-dependent. |
| Paste multiline | Draft the task in an editor, then paste it. |
| File-based spec | Put 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.
Menus, completion, history
| Shortcut | Meaning |
|---|---|
Tab | Complete slash commands, paths, or menu items |
Up | Previous input or move menu selection up |
Down | Next input or move menu selection down |
Enter | Submit or confirm selection |
Esc | Close 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
| Shortcut | Meaning |
|---|---|
Cmd + V | Paste prompts, logs, or notes |
Cmd + A | Select current input text |
Cmd + Z | Undo text edits in the input box |
Cmd + F | Search in the focused browser/document view |
Cmd + W | Close 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
| Scenario | Shortcut |
|---|---|
| Help | ? |
| Stop a drifting run | Esc |
| Exit | Ctrl + D |
| Redraw screen | Ctrl + L |
| Switch mode | Shift + Tab |
| Start of line | Ctrl + A |
| End of line | Ctrl + E |
| Delete before cursor | Ctrl + U |
| Delete after cursor | Ctrl + K |
| Delete word | Ctrl + W |
| Complete | Tab |
| Previous prompt | Up |
When shortcuts fail
| Symptom | Cause | Fix |
|---|---|---|
Option + B/F prints odd characters | Option is not sending Meta | Enable Esc+ or Meta in terminal settings |
Shift + Enter submits | Terminal does not pass newline combo | Use pasted multiline specs or configure terminal keys |
Ctrl + S freezes output | Terminal flow control paused output | Press Ctrl + Q; consider stty -ixon |
Tab does not complete | Focus or menu state mismatch | Refocus input, press Esc, retry |
Cmd shortcuts do nothing | Pure terminal does not receive app shortcuts | Use 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.
Related
- Codex Beginner Guide
- Codex Skills and /skills Guide
- Codex vs Claude Code
- AI Coding Context Management
Tags: #AI coding #Codex #Tutorial