Answer: Create a policy file ending in .toml in the ~/.gemini/policies directory with a rule specifying toolName = "run_shell_command", the commandPrefix to block, decision = "deny", and a priority. Status: Confirmed Entry: tool/gemini-cli/permissions-and-security/create-policy-block-shell-command Revision: 1 Digest: sha256:6cdf2bdad6641265 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:18:49Z Last changed: 2026-11-13T03:18:49Z Last verified: 2026-11-20T12:53:34Z Next check: 2026-11-21T12:53:34Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of policy directory | ~/.gemini/policies | [1] | 2026-11-20 policy file example | ~/.gemini/policies/my-rules.toml | [1] | 2026-11-20 tool name | run_shell_command | [1] | 2026-11-20 command prefix | rm -rf | [1] | 2026-11-20 decision | deny | [1] | 2026-11-20 priority | 100 | [1] | 2026-11-20 Sources: [1] Google. "Policy engine". https://geminicli.com/docs/reference/policy-engine.md Role: primary. Accessed: 2026-11-20T12:53:34Z Quote: "mkdir -p ~/.gemini/policies" (Supports: policy directory) Quote: "`~/.gemini/policies/my-rules.toml`" (Supports: policy file example) Quote: "toolName = "run_shell_command"" (Supports: tool name) Quote: "commandPrefix = "rm -rf"" (Supports: command prefix) Quote: "decision = "deny"" (Supports: decision) Quote: "priority = 100" (Supports: priority) Published: 2026-10-16T02:36:07Z Snapshot SHA-256: 0caa715d2a1a1bc13343b6966177d07538b63b73d3b6436ea9cc3c2b7697adb4 (captured 2026-11-15T12:57:40Z) 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:18:49Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T12:53:34Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:53:34Z Last attempt: 2026-11-20T12:53:34Z Notes and limitations: Extracted automatically from a single official source (section "Quick start"). Related: https://latestn.com/tool/gemini-cli/permissions-and-security/disable-yolo-mode How do I disable YOLO mode in Gemini CLI for enterprise deployments? https://latestn.com/tool/gemini-cli/permissions-and-security/enable-sandboxing How do I enable sandboxing in Gemini CLI? https://latestn.com/tool/gemini-cli/permissions-and-security/enable-sandboxing-dev How do I enable sandboxing when developing Gemini CLI? https://latestn.com/tool/gemini-cli/models/model-options What model options are available in Gemini CLI's /model command? https://latestn.com/tool/gemini-cli/models/model-selection-precedence What is the model selection precedence in Gemini CLI? https://latestn.com/tool/gemini-cli/models/select-model How do I select a model in Gemini CLI? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:18:49Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/gemini-cli/permissions-and-security/create-policy-block-shell-command/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/permissions-and-security/create-policy-block-shell-command POST: https://latestn.com/dispute/tool/gemini-cli/permissions-and-security/create-policy-block-shell-command with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/gemini-cli/permissions-and-security/create-policy-block-shell-command?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I create a policy in Gemini CLI to block a specific shell command? Revision 1, last verified 2026-11-20T12:53:34Z. https://latestn.com/tool/gemini-cli/permissions-and-security/create-policy-block-shell-command (accessed 2026-11-21T10:00:22Z). @misc{LatestN_tool_gemini_cli_permissions_and_security_create_policy_block_shell_command_r1, title = {How do I create a policy in Gemini CLI to block a specific shell command?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/gemini-cli/permissions-and-security/create-policy-block-shell-command}}, note = {Revision 1; digest sha256:6cdf2bdad6641265; last verified 2026-11-20T12:53:34Z; accessed 2026-11-21T10:00:22Z} } 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/permissions-and-security/create-policy-block-shell-command