Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Codex Quick Reference

Codex Quick Reference

This appendix contains a command quick reference, FAQs, and version update information.


Command Quick Reference

Basic CLI Commands

Command Description
codex Start interactive TUI
codex "任务" Start and execute a specified task
codex exec "任务" Execute a task in non-interactive mode
codex --version Display version information
codex --help Display help information

Slash commands

Command Description
/model Switching models
/fast Toggle Fast mode
/plan Enter plan mode
/review Review code changes
/new Start a new session
/resume Resume a history session
/fork Clone the current session
/compact Compress the context
/status Show session status
/clear Clear the screen
/quit Exit Codex
/approval Switch approval mode

CLI parameters

Parameters Description
-m Specify model
--sandbox Set the sandbox mode
--approval-mode Set approval mode
-i Attach an image
-o Output to a file (exec)
--full-auto Fully automatic execution
--ephemeral Do not save session files
--reasoning-effort Reasoning effort

Shell command execution

Format Description
! Execute shell commands in Codex
! git status View Git status
! npm test Running tests

Configuration file paths

Config file locations

file Path Purpose
User configuration ~/.codex/config.toml Global default configuration
Project configuration .codex/config.toml Project-specific configuration
Project instructions AGENTS.md Project behavior guidelines
Log directory ~/.codex/log/ Runtime logs
Session directory ~/.codex/sessions/ Session records

Skill directories

Position Path
Project-level .agents/skills/
User level ~/.agents/skills/
System level /etc/codex/skills/

Keyboard shortcut

CLI keyboard shortcuts

Keyboard shortcut Function
Enter Send the message
Shift+Enter Newline
Ctrl+C Interrupt operation
Ctrl+C (两次) Exit Codex
Ctrl+D Exit (when input is empty)
Ctrl+R Search history
Up/Down Browse history
Tab Autocompletion
Esc Esc Edit the previous message
Ctrl+O Copy the last response

App keyboard shortcuts

Keyboard shortcut Function
Cmd/Ctrl+N New session
Cmd/Ctrl+Shift+N New window
Cmd/Ctrl+W Close window/tab
Cmd/Ctrl+[ Previous tab
Cmd/Ctrl+] Next tab

Common questions

Installation and Authentication

Q: How do I install Codex CLI?

Use npm or Homebrew:



npm install -g @openai/codex

# 或

brew install codex

Q: How do I authenticate on first use?

Running the codex command automatically opens a browser for authentication; sign in with a ChatGPT account or API Key.

Q: Windows support status?

Native Windows support is experimental; WSL2 is recommended for the best experience.

Usage issues

Q: How do I view the current configuration?

Use /status The command views the configuration and status of the current session.

Q: How do I disable the alternate screen?

Use codex --no-alt-screen Or configure alternate_screen = "never"。

Q: What should I do if a command is not found?

Make sure PATH includes the npm global installation directory, or install via Homebrew.

Q: How do I view logs?

Logs are located at ~/.codex/log/ directory.

Feature issues

Q: What's the difference between exec and interactive mode?

exec runs once and then exits, suitable for automation scripts; interactive mode maintains an ongoing conversation, suitable for daily development.

Q: How do I resume a previous session?

Use /resume Command or codex resume --last。

Q: Can GitHub Actions modify files?

Yes, set sandbox: workspace-write.

Q: How do I authenticate in CI/CD?

Use the CODEX_API_KEY environment variable, stored as a Secret.

Security Issue

Q: How do I prevent Codex from deleting important files?

Use read-only or workspace-write sandbox mode, and configure Rules to prohibit dangerous commands.

Q: Is full-auto mode safe?

full-auto automatically performs all operations, including deleting files; use it with caution.

Q: How do I handle sensitive data?

Use Secrets storage, available only in setup scripts.


Version updates

Recent updates

Version Date What's new
v1.5.0 2026-04 Added support for the GPT-5.4 series of models
v1.4.0 2026-03 Improved Worktree functionality
v1.3.0 2026-02 Added Review Mode
v1.2.0 2026-01 Optimized MCP Server support
v1.1.0 2025-12 Added GitHub integration
v1.0.0 2025-11 Codex officially released

Update the CLI

Update command

Update via npm

npm

install

-g

@

openai

/

codex

@

latest

Update via Homebrew

brew upgrade codex

View the current version

codex

--version


Related Resources

Official Resources

Resource Address
Official documentation https://developers.openai.com/codex
GitHub https://github.com/openai/codex
Codex Web https://chatgpt.com/codex
Discord https://discord.gg/openai

Tutorial series

Section Title Content
01 Getting Started with Codex Core capabilities, plan comparison
02 Core Concepts Prompt、Thread、Context、Sandbox
03 Desktop app App features, Review mode
04 IDE extensions VS Code、Cursor、Windsurf
05 command line tool CLI installation, TUI, Approval
06 Cloud version Web interface, Environments
07 Integrations and connections GitHub、Slack、Linear、MCP
08 Configuration and customization Config、Rules、Skills
09 Automation and CI/CD exec、SDK、GitHub Action
10 Workflow modes Development workflow, refactoring, bug fixes
11 Prompt best practices Prompt structure, task breakdown
12 Security and enterprise management Sandbox, permissions, audit logs
13 Model selection GPT-5.4 series, reasoning effort
14 Appendix Command quick reference, FAQs

Glossary

Term Description
Agent Codex's core execution unit, capable of understanding tasks and performing actions
Prompt Task instructions sent by the user to Codex
Thread A session sequence containing the complete conversation history
Context The range of information available to Codex, including files, conversations, and configuration
Sandbox An isolated execution environment that limits Codex's scope of operations
Approval An approval policy that controls confirmation behavior before actions are executed
AGENTS.md A project instruction file that defines Codex's behavioral guidelines
Skill A reusable custom capability module
Subagent A subagent, used to handle complex tasks in parallel
Rules A rule engine that defines command execution permissions
MCP Model Context Protocol, a protocol for connecting external tools
Worktree Git worktree, used to isolate working directories for different tasks

Feedback and support

Get help

Report issues

Codex is continuously updated and improved; follow official channels for the latest information.