YouTip LogoYouTip

Codex Commands

This appendix contains command cheat sheets, frequently asked questions, and version update information. * * * ## Command Cheat Sheet ### CLI Basic Commands | Command | Description | | --- | --- | | `codex` | Launch interactive TUI | | `codex "task"` | Launch and execute specified task | | `codex exec "task"` | Execute task in non-interactive mode | | `codex --version` | Display version information | | `codex --help` | Display help information | ### Slash Commands | Command | Description | | --- | --- | | `/model ` | Switch model | | `/fast` | Switch to Fast mode | | `/plan` | Enter plan mode | | `/review` | Review code changes | | `/new` | Start new session | | `/resume` | Resume historical session | | `/fork` | Clone current session | | `/compact` | Compress context | | `/status` | Display session status | | `/clear` | Clear screen | | `/quit` | Exit Codex | | `/approval ` | Switch approval mode | ### CLI Parameters | Parameter | Description | | --- | --- | | `-m ` | Specify model | | `--sandbox ` | Set sandbox mode | | `--approval-mode ` | Set approval mode | | `-i ` | Attach image | | `-o ` | Output to file (exec) | | `--full-auto` | Fully automatic execution | | `--ephemeral` | Do not save session files | | `--reasoning-effort ` | Reasoning effort | ### Shell Command Execution | Format | Description | | --- | --- | | `! ` | Execute Shell command in Codex | | `! git status` | Check Git status | | `! npm test` | Run tests | * * * ## Configuration File Paths ### Configuration File Locations | File | Path | Purpose | | --- | --- | --- | | User config | `~/.codex/config.toml` | Global default configuration | | Project config | `.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 | ### Skills Directory | Location | Path | | --- | --- | | Project-level | `.agents/skills/` | | User-level | `~/.agents/skills/` | | System-level | `/etc/codex/skills/` | * * * ## Keyboard Shortcuts ### CLI Shortcuts | Shortcut | Function | | --- | --- | | `Enter` | Send message | | `Shift+Enter` | New line | | `Ctrl+C` | Interrupt operation | | `Ctrl+C (twice)` | Exit Codex | | `Ctrl+D` | Exit (when input is empty) | | `Ctrl+R` | Search history | | `Up/Down` | Browse history | | `Tab` | Auto-complete | | `Esc Esc` | Edit previous message | | `Ctrl+O` | Copy last response | ### App Shortcuts | 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 | * * * ## Frequently Asked Questions ### Installation and Authentication #### Q: How to install Codex CLI? Use npm or Homebrew: npm install -g @openai/codex # or brew install codex #### Q: How to authenticate for the first time? Running the `codex` command will automatically open a browser for authentication. Log in with your ChatGPT account or API Key. #### Q: What is the Windows support status? Native Windows support is experimental. WSL2 is recommended for the best experience. ### Usage Questions #### Q: How to view current configuration? Use the `/status` command to view the current session's configuration and status. #### Q: How to disable the alternate screen? Use `codex --no-alt-screen` or configure `alternate_screen = "never"`. #### Q: What to do if the command is not found? Ensure PATH includes the npm global installation directory, or install using Homebrew. #### Q: How to view logs? Logs are located in the `~/.codex/log/` directory. ### Feature Questions #### Q: What is the difference between exec and interactive mode? exec exits after a single execution, suitable for automation scripts; interactive mode maintains continuous conversation, suitable for daily development. #### Q: How to resume a historical session? Use the `/resume` command or `codex resume --last`. #### Q: Can GitHub Action modify files? Yes, set `sandbox: workspace-write`. #### Q: How to authenticate in CI/CD? Use the `CODEX_API_KEY` environment variable, stored as Secrets. ### Security Questions #### Q: How to prevent Codex from deleting important files? Use read-only or workspace-write sandbox modes, and configure Rules to prohibit dangerous commands. #### Q: Is full-auto mode safe? full-auto will automatically execute all operations, including deleting files. Please use with caution. #### Q: How to handle sensitive data? Use Secrets storage, only available in setup scripts. * * * ## Version Updates ### Recent Updates | Version | Date | Update Content | | --- | --- | --- | | v1.5.0 | 2026-04 | Added GPT-5.4 series model support | | 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 CLI ## Update Command # npm update npm install-g@openai/codex@latest # Homebrew update brew upgrade codex # View current version codex --version * * * ## Related Resources ### Official Resources | Resource | Address | | --- | --- | | Official Documentation | [https://developers.openai.com/codex](https://developers.openai.com/codex) | | GitHub | [https://github.com/openai/codex](https://github.com/openai/codex) | | Codex Web | [https://chatgpt.com/codex](https://chatgpt.com/codex) | | Discord | [https://discord.gg/openai](https://discord.gg/openai) | ### Tutorial Series | Chapter | Title | Content | | --- | --- | --- | | 01 | Codex Getting Started | 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 | Integration and Connectivity | GitHub, Slack, Linear, MCP | | 08 | Configuration and Customization | Config, Rules, Skills | | 09 | Automation and CI/CD | exec, SDK, GitHub Action | | 10 | Workflow Patterns | Development process, refactoring, bug fixing | | 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 cheat sheet, FAQ | * * * ## Glossary | Term | Description | | --- | --- | | **Agent** | Codex's core execution unit, capable of understanding tasks and executing operations | | **Prompt** | Task instructions sent by the user to Codex | | **Thread** | Conversation sequence, containing complete dialogue history | | **Context** | Information available to Codex, including files, conversations, and configuration | | **Sandbox** | Isolated execution environment, limiting Codex's operational scope | | **Approval** | Approval policy, controlling confirmation behavior before operation execution | | **AGENTS.md** | Project instruction file, defining Codex's behavior guidelines | | **Skill** | Reusable custom capability module | | **Subagent** | Sub-agent, used for parallel processing of complex tasks | | **Rules** | Rules engine, defining command execution permissions | | **MCP** | Model Context Protocol, protocol for connecting external tools | | **Worktree** | Git worktree, used for isolating working directories for different tasks | * * * ## Feedback and Support ### Getting Help * Use the `/help` command to view built-in help * Visit official documentation for detailed explanations * Join the Discord community for discussions ### Reporting Issues * GitHub Issues: (https://github.com/openai/codex/issues) * Submit suggestions through Codex feedback feature > Codex is continuously updated and iterated. Follow official channels for the latest information.
← Lua EditorCodex Config File β†’