Run shell commands from the prompt

tools & sandbox

// what it does

Prefix a line with ! to run a shell command directly and inject its output into the context, so the model sees the result. Type a lone ! to toggle persistent shell mode, where every line goes to the shell until you toggle back. Subprocesses run with GEMINI_CLI=1 set so scripts can detect they were launched by the CLI.

// shell

$ !git status
$ !npm test

// gotcha

! output is added to context and counts against tokens — a chatty command like a full build log can flood the window. These shell commands run on your real machine (unless you launched with --sandbox) and are not covered by checkpointing, so their side effects cannot be undone with /restore.

// resources