[Go to site: main page, start]

Skip to main content

Command Palette

Search for a command to run...

CLI

Cursor CLI

Cursor CLI lets you interact with AI agents directly from your terminal to write, review, and modify code. Whether you prefer an interactive terminal interface or print automation for scripts and CI pipelines, the CLI provides powerful coding assistance right where you work.

Getting started

# Install (macOS, Linux, WSL)curl https://cursor.com/install -fsS | bash# Install (Windows PowerShell)irm 'https://cursor.com/install?win32=true' | iex# Run interactive sessionagent

Interactive mode

Start a conversational session with the agent to describe your goals, review proposed changes, and approve commands:

# Start interactive sessionagent# Start with initial promptagent "refactor the auth module to use JWT tokens"

Modes

The CLI supports the same modes as the editor. Switch between modes using slash commands, keyboard shortcuts, or the --mode flag.

ModeDescriptionShortcut
AgentFull access to all tools for complex coding tasksDefault (no --mode value needed)
PlanDesign your approach before coding with clarifying questionsShift+Tab, /plan, --plan, --mode=plan
AskRead-only exploration without making changes/ask, --mode=ask

Non-interactive mode

Use print mode for non-interactive scenarios like scripts, CI pipelines, or automation:

# Run with specific prompt and modelagent -p "find and fix performance issues" --model "gpt-5"# Use with git changes included for reviewagent -p "review these changes for security issues" --output-format text

Cloud Agent handoff

Push your conversation to a Cloud Agent to continue running while you're away. Prepend & to any message:

# Send a task to Cloud Agent mid-conversation& refactor the auth module and add comprehensive tests

Pick up your Cloud Agent tasks on web or mobile at cursor.com/agents.

Sessions

Resume previous conversations to maintain context across multiple interactions:

# Open previous chats and resume oneagent ls# Resume latest conversationagent resume# Continue the previous sessionagent --continue# Resume specific conversationagent --resume="chat-id-here"

Sandbox controls

Configure command execution settings with /sandbox or the --sandbox <mode> flag (enabled or disabled). Toggle sandbox mode on or off and control network access through an interactive menu. Settings persist across sessions.

Sudo password prompting

Run commands requiring elevated privileges without leaving the CLI. When a command needs sudo, Cursor displays a secure, masked password prompt. Your password flows directly to sudo via a secure IPC channel; the AI model never sees it.