Answer: Run Gemini CLI in headless mode by providing a prompt with the `-p` (or `--prompt`) flag, for example: `gemini -p "Write a poem about TypeScript"`. Status: Confirmed Entry: tool/gemini-cli/agents-and-automation/run-headless-mode-single-prompt Revision: 1 Digest: sha256:4d32323b9d6f0cb8 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:17:54Z Last changed: 2026-11-13T03:17:54Z Last verified: 2026-11-20T12:51:45Z Next check: 2026-11-21T12:51:45Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of flag | -p | [1] | 2026-11-20 long flag | --prompt | [1] | 2026-11-20 example command | gemini -p "Write a poem about TypeScript" | [1] | 2026-11-20 Sources: [1] Google. "Automate tasks with headless mode". https://geminicli.com/docs/cli/tutorials/automation.md Role: primary. Accessed: 2026-11-20T12:51:45Z Quote: "Run Gemini CLI in headless mode by providing a prompt with the `-p` (or" (Supports: flag) Quote: "`--prompt`) flag. This bypasses the interactive chat interface and prints the" (Supports: long flag) Quote: "gemini -p "Write a poem about TypeScript"" (Supports: example command) Published: 2026-10-16T02:36:07Z Snapshot SHA-256: b91e786382d8ff961a0eb4f79ef13444627abdcc5e58c0a92ff82dca93a10bf6 (captured 2026-11-13T03:17:54Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-13T03:17:54Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T12:51:45Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:51:45Z Last attempt: 2026-11-20T12:51:45Z Notes and limitations: Extracted automatically from a single official source (section "How to use headless mode"). Related: https://latestn.com/tool/gemini-cli/agents-and-automation/skill-degrees-of-freedom How do I choose the right level of instruction detail for a Gemini CLI Agent Skill? https://latestn.com/tool/gemini-cli/agents-and-automation/skill-discovery-tiers How does Gemini CLI discover Agent Skills and what are the discovery tiers? https://latestn.com/tool/gemini-cli/agents-and-automation/steer-research-phase How do I steer Gemini CLI's research phase during Plan Mode? https://latestn.com/tool/gemini-cli/agents-and-automation/pr-size-labeler How are pull requests automatically labeled by size in Gemini CLI? https://latestn.com/tool/gemini-cli/agents-and-automation/pull-request-ci What CI checks run when I open a pull request in Gemini CLI? https://latestn.com/tool/gemini-cli/agents-and-automation/review-iterate-plan How do I review and iterate on a plan Gemini CLI generated? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:17:54Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/gemini-cli/agents-and-automation/run-headless-mode-single-prompt/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/gemini-cli/agents-and-automation/run-headless-mode-single-prompt POST: https://latestn.com/dispute/tool/gemini-cli/agents-and-automation/run-headless-mode-single-prompt with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/gemini-cli/agents-and-automation/run-headless-mode-single-prompt?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I run Gemini CLI in headless mode with a single prompt? Revision 1, last verified 2026-11-20T12:51:45Z. https://latestn.com/tool/gemini-cli/agents-and-automation/run-headless-mode-single-prompt (accessed 2026-11-21T10:07:23Z). @misc{LatestN_tool_gemini_cli_agents_and_automation_run_headless_mode_single_prompt_r1, title = {How do I run Gemini CLI in headless mode with a single prompt?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/gemini-cli/agents-and-automation/run-headless-mode-single-prompt}}, note = {Revision 1; digest sha256:4d32323b9d6f0cb8; last verified 2026-11-20T12:51:45Z; accessed 2026-11-21T10:07:23Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/gemini-cli/agents-and-automation/run-headless-mode-single-prompt