| name | gh-copilot-cli |
| description | Use GitHub Copilot in the CLI to get AI-suggested shell commands, explain commands, and translate natural language to terminal commands via the gh copilot extension. |
GitHub Copilot CLI (gh copilot)
AI-powered terminal assistant. Translate natural language to shell commands, explain commands, and get suggestions.
Prerequisites
Requires an active GitHub Copilot subscription and the gh CLI.
Setup
gh extension install github/gh-copilot
gh copilot --version
Common Commands
Suggest Commands
gh copilot suggest "find all large files over 100MB"
gh copilot suggest "compress all PNG files in this directory"
gh copilot suggest "create a git branch from a specific commit"
gh copilot suggest "find and kill process on port 3000"
gh copilot suggest "set up a cron job to run daily at 9am"
Explain Commands
gh copilot explain "tar -xzf archive.tar.gz"
gh copilot explain "find . -name '*.log' -mtime +30 -delete"
gh copilot explain "awk '{print $2}' file.txt | sort | uniq -c"
gh copilot explain "ssh -L 8080:localhost:80 user@server"
Shell Aliases (for convenience)
Agent Best Practices
- Use
suggest to generate complex shell commands from natural language descriptions
- Use
explain to understand unfamiliar commands before running them
- The tool supports git, shell, and gh-specific command suggestions
- Suggestions are context-aware (considers current directory, OS, shell)
- Always review suggested commands before executing - they may need adjustment
- Use this for command discovery, not as a replacement for known commands
Example Workflows
Find the right command for a task
gh copilot suggest "recursively find all TypeScript files modified in the last week"
Understand a complex pipeline
gh copilot explain "git log --oneline --graph --all --decorate"