Ask Copilot to explain a code file directly from the terminal.

Section: Interactive and one-shot prompts

Explain a source file

bash
bash
copilot -p "Explain this file: ./complex.ts"
Explanation

A strong workflow for quick code comprehension.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Interactive and one-shot prompts
Summarize a file from the command line
Run Copilot non-interactively with a prompt.
OpenIn sheetbashsame section
Pipe a prompt to Copilot
Send prompt text over stdin.
OpenIn sheetbashsame section
Ask a CLI how-to question
Get a concise terminal answer about a shell task.
OpenIn sheetbashsame section
Ask for a refactor plan
Use Copilot to plan work before making changes.
OpenIn sheetbashsame section
Summarize recent commits
Use Git context from the repo in a direct prompt.
OpenIn sheetbashsame section
Inject a file into the prompt context
Reference a file inline inside the interactive UI.
OpenIn sheettext1 tag match