GitHub Copilot for the Command Line
GitHub Copilot isn’t just for Integrated Development Environments(IDEs)—it’s now a powerful assistant in your terminal. GitHub Copilot CLI brings Copilot directly into the command line, where it can explain commands, suggest shell commands from natural language, and help you work safely and interactively with your files and projects.
Copilot CLI uses GitHub authentication and runs independently from GitHub CLI, though it uses your existing credentials. Whether you’re new to the command line or an experienced developer, Copilot CLI reduces guesswork and speeds up everyday workflows.
This unit covers:
- Installing and running GitHub Copilot CLI
- Interactive sessions in the terminal
- Slash commands and natural language input
- Configuration and options
Installing and launching Copilot CLI
Install via Homebrew on macOS and Linux:
brew install copilot-cli
Or use the official install script:
curl -fsSL https://gh.io/copilot-install | bash
Launch Copilot CLI in interactive mode:
copilot
It displays see a welcome banner and a prompt:
On first launch, Copilot asks whether you trust the files in the current folder. Copilot may read, modify, or execute files in this directory during the session, so only proceed in locations you trust.
You can use the @ to select a specific file you want to work with as context.
Inside an interactive session, you can:
- Use slash commands (
/command) to control the session and configure Copilot CLI. - Type natural language prompts to explain, suggest, or revise commands.
For one-shot prompts without entering full interactive mode:
copilot -i "explain brew install git"
copilot -i "suggest find large files and delete them"
Common slash commands
Slash commands are explicit session-control commands. Here are the most common ones:
| Slash Command | Description |
|---|---|
/help |
Show available commands and options |
/explain <command> |
Ask Copilot to explain any shell command |
/suggest <task> |
Ask Copilot to suggest a shell command for a task |
/revise |
Revise the last suggestion based on your instructions |
/feedback |
Submit feedback on a response or suggestion |
/exit |
Exit interactive mode |
/model <model> |
Select which AI model to use |
/theme [auto|dark|light] |
Change terminal theme |
/skills |
Manage skills for enhanced capabilities |
/mcp |
Manage MCP server configuration |
/list-dirs |
Show allowed directories for file operations |
/reset-allowed-tools |
Reset allowed tools list |
Slash commands cannot be replaced with natural language prompts. They are the only way to control session settings and configuration.
Example workflows
1. Explain a command
> Explain what `git reset --hard HEAD` does
Copilot will provide a detailed explanation.
2. Suggest a command
> Find and delete all .log files in my home folder
Copilot generates a command suggestion, and prompt you to execute it if you're satisfied with its suggestions.
3. Revise a suggestion
After receiving a suggestion, you can type a follow-up prompt to revise the suggested command:
> Include only files modified in the last 7 days
4. Provide feedback
After a response or suggestion:
> /feedback
Copilot prompts you to choose the kind of feedback you want to send, then navigate you to the appropriate form to complete your feedback.
5. Exit interactive mode
> /exit
Configuration options
In Copilot CLI, configuration is handled via:
Slash commands inside interactive mode
/modelchoose AI model/themechange terminal theme/skillsmanage enhanced capabilities/reset-allowed-toolsreset tools/list-dirsview allowed directories/mcpMCP server settings
Copilot CLI configuration (non-interactive mode)
Copilot CLI configuration is managed through permission prompts, command-line flags, and local configuration files. These settings control what Copilot can access and do on your behalf.
Common configuration options include:
- Trusted directories – Control where Copilot can read, edit, and run files.
- Tool permissions – Allow or restrict Copilot from running shell commands or modifying files using flags like
--allow-toolor--deny-tool. - Path permissions – Control which directories Copilot can access.
- URL permissions – Manage which external domains Copilot can connect to.
Refer to the official GitHub Copilot CLI documentation for full configuration options.
Tips for effective use
- Use interactive mode (
copilot) for exploratory tasks. - Use one-shot mode (
copilot -i) for quick answers. - Natural language input works—you don’t always need slash commands.
- Always review commands before execution.
- Combine Copilot CLI with GitHub CLI (
gh) for repository and issue management. - Use slash commands when you want structured actions or feedback.