Codex Command Line Tool (CLI)
The CLI is useful for terminal-first workflows, scripting, CI, and power users.
Start And Basic Usage
Run from the repository you want Codex to inspect, or pass a working directory when supported.
Subcommands
Common subcommands include interactive sessions, non-interactive exec, login/logout, and diagnostic commands.
Common Flags
Use flags and -c overrides to set model, permissions, working directory, and feature behavior for one run.
CLI Configuration
The CLI reads config.toml from CODEX_HOME unless overridden.
CLI Sandbox And Safety
Use read-only mode for planning and workspace-write for normal local coding. Avoid full access unless you trust the environment.
CLI Skills
Skills work in the CLI as specialized instruction bundles. Invoke them explicitly or let Codex trigger them when appropriate.
CLI Model Selection
Switch models through config, flags, or session commands such as /model when available.
CLI Prompting Tips
- State the goal and verification command.
- Mention files or directories.
- Keep constraints explicit.
- Ask for a concise final summary.
CLI Practical Examples
Next Steps
Finish with Resources.