Gemini CLI keyboard shortcuts, slash commands and flags
Keys, slash commands and launch options of Gemini CLI 0.63.0, Google's terminal coding agent, checked against the keyboard-shortcut, command and cheatsheet pages in its repository and the CLI's own help output. A single column serves Windows, macOS and Linux, because the bindings are terminal keys; only undo differs by system. Words in capitals such as QUERY or NAME stand for your own value. Vim keys apply once /vim is on, and every default can be remapped in ~/.gemini/keybindings.json.
Break the line with a backslashType the backslash as the last character, then Enter; the input stays in single-line mode.
\thenEnter
Open external editorHands the prompt being written, or a plan on screen, to your configured editor.
Ctrl+GorCtrl+Shift+G
Edit the presented planWorks while a plan is on screen; the key table also lists it as the deprecated external-editor command.
Ctrl+X
Paste from the clipboard
Ctrl+VorCmd+VorAlt+V
Expand a paste placeholderWith the cursor on a [Pasted Text: X lines] marker, shows or hides the pasted text inline.
Ctrl+O
Expand a placeholder by mouseAlternate buffer mode only; a second double-click folds the text away again.
Double-click
Toggle the shortcuts panelWorks on an empty prompt; Esc, Backspace or any printable key closes the panel again.
?
Switch minimal and full UIPress Tab twice while typing with no completion or search active; the choice is remembered for later sessions.
TabthenTab
Push to talk in Voice ModeHold the key down for as long as you are speaking.
Space
Cursor movement 8
Action
Shortcut
Go to line start
Ctrl+AorHome
Go to line end
Ctrl+EorEnd
Move up one lineOn the top line of the input it recalls the previous prompt from history instead.
Up
Move down one lineOn the bottom line of the input it steps forward through prompt history instead.
Down
Move left one character
Left
Move right one character
RightorCtrl+F
Move left one word
Ctrl+LeftorAlt+LeftorAlt+B
Move right one word
Ctrl+RightorAlt+RightorAlt+F
Editing text 9
Where Google's key table prints Cmd/Win, this page writes Cmd: the Command key on a Mac keyboard, the Windows key on others.
Action
Shortcut
Delete to line end
Ctrl+K
Delete to line start
Ctrl+U
Clear the inputWipes everything typed in the input field; on an empty input the same key cancels or quits.
Ctrl+C
Delete previous word
Ctrl+BackspaceorAlt+BackspaceorCtrl+W
Delete next word
Ctrl+DeleteorAlt+DeleteorAlt+D
Delete previous character
BackspaceorCtrl+H
Delete next characterOn an empty input, Ctrl + D exits the CLI instead.
DeleteorCtrl+D
Undo a text editThe commands page gives Ctrl + Z for Windows, Cmd + Z for macOS and Alt + Z for Linux or WSL.
Ctrl+ZorAlt+ZorCmd+Z
Redo a text editRestores the change that the last undo removed from the input.
Ctrl+Shift+ZorCmd+Shift+ZorAlt+Shift+Z
History and suggestions 11
Action
Shortcut
Previous history entry
Ctrl+P
Next history entry
Ctrl+N
Browse prompt historyTakes effect when the cursor sits on the top or bottom line of a single-line input.
UporDown
Reverse history searchOpens a backwards search over the prompts entered earlier.
Ctrl+R
Submit the search matchOnly during a reverse search, where it sends the match that is selected.
Enter
Accept a search suggestionOnly applies while a reverse history search is open.
Tab
Accept the inline suggestion
TaborEnter
Previous completion option
UporCtrl+P
Next completion option
DownorCtrl+N
Expand an inline suggestion
Right
Collapse an inline suggestion
Left
Approval modes and session control 8
In Windows Terminal, Shift+Tab is not supported on Node 20 and on earlier versions of Node 22.
Action
Shortcut
Cycle approval modesSteps through default, auto-edit and plan; plan is left out while the agent is busy.
Shift+Tab
Toggle YOLO modeWhile it is on, tool calls go ahead without asking for approval.
Ctrl+Y
Cancel request or quitStops the request in progress, or quits the CLI if the input is already empty.
Ctrl+C
Exit the CLIExits only when nothing is typed; with text present it deletes the character to the right.
Ctrl+D
Dismiss or cancelCloses the open dialog or cancels whatever currently has focus.
EscorCtrl+[
Clear input or rewindClears a prompt that has text in it; on an empty one it opens the rewind view of earlier interactions.
EscthenEsc
Suspend the CLI
Ctrl+Z
Restart the application
RorShift+R
Scrolling and display 17
Action
Shortcut
Scroll content up
Shift+Up
Scroll content down
Shift+Down
Scroll to the top
Ctrl+HomeorShift+Home
Scroll to the bottom
Ctrl+EndorShift+End
Scroll up one page
Page Up
Scroll down one page
Page Down
Clear the screenRedraws the UI and keeps the conversation; /clear is what starts a new session.
Ctrl+L
Show or hide the TODO list
Ctrl+T
Expand or collapse output blocksApplies outside alternate buffer mode, to long blocks of content.
Ctrl+O
Toggle Markdown rendering
Alt+M
Toggle mouse modeMouse mode is what lets you scroll and click inside the UI.
Ctrl+S
Toggle copy modeOnly has an effect when the UI runs in alternate buffer mode.
F9
Toggle the debug consoleShows detailed error information, plus the extra logging when started with --debug.
F12
Show IDE context details
F4
Start recording the session
F6
Stop recording the session
F7
Dump the current frameSaves the frame on screen as a snapshot.
F8
Dialogs and lists 14
Action
Shortcut
Confirm the selection
Enter
Select the previous list item
Up
Select the next list item
Down
Previous dialog option
UporK
Next dialog option
DownorJ
Next dialog item or question
Tab
Previous dialog item or question
Shift+Tab
Pick a numbered optionIn selection dialogs; multi-digit numbers work, and the option is confirmed once the whole number is typed.
1-9
Search the session browserTyping after the slash filters the /resume list by session ID or content.
/
Resume the selected session
Enter
Close the session browser
Esc
Delete the highlighted sessionWorks on the entry you have navigated to in the /resume session browser.
X
Update the current extensionDoes something only if an update is available for it.
I
Link the extension locally
L
Shell focus and background shells 9
Action
Shortcut
Focus the active shellMoves keyboard focus from the Gemini prompt into the shell that is running.
Tab
Return focus to GeminiLeaves the shell input and puts focus back on the prompt.
Shift+Tab
Show or hide background shell
Ctrl+B
Toggle the background shell list
Ctrl+L
Kill the background shell
Ctrl+K
Select a background shellConfirms the entry highlighted in the background shell list.
Enter
Dismiss the background shell list
Esc
Leave the background shellFocus goes from the background shell back to Gemini.
Shift+Tab
Leave the background shell listFocus goes from the list of background shells back to Gemini.
Tab
File references and shell mode 6
Action
Shortcut
Reference a file or directoryType a path right after the sign to add its content to the prompt; git-ignored files are skipped by default.
@
Include one fileThe file is read and its text is inserted into the query before it is sent.
@path/to/your/file.txt
Include a whole directoryReads the files in that folder and in its subdirectories.
@src/my_project/
Reference a path with spacesPut a backslash before each space in the path.
@My\ Documents/file.txt
Toggle shell modeTyped alone on an empty prompt; while it is on, each line you enter runs as a shell command.
!
Run one shell commandWhatever follows the exclamation mark runs in bash, or PowerShell on Windows, and control then returns to Gemini CLI.
!ls -la
Vim mode switching and movement 24
Action
Shortcut
Return to NORMAL modeLeaves INSERT mode; the status footer then shows [NORMAL].
Esc
Insert at the cursor
i
Insert after the cursor
a
Insert at line start
I
Insert at line end
A
Open a line belowAdds the new line under the current one and switches to INSERT mode.
o
Open a line above
O
Clear the input (NORMAL mode)
EscthenEsc
Move left
h
Move down
j
Move up
k
Move right
l
Go to line start
0
Go to first non-blank character
^
Go to line end
$
Forward one word
w
Back one word
b
Go to word end
e
Forward one WORD
W
Back one WORD
B
Go to WORD end
E
Go to first line
gg
Go to last line
G
Go to line NN stands for the line number, typed before the command.
N GorN gg
Vim mode editing 27
A count typed first repeats a command: 3dd deletes three lines and 2cw changes two words. Delete and change also combine with character finds, as in dfx or cTx.
Action
Shortcut
Delete character under cursor
x
Delete to line end
D
Delete line
dd
Change to line end
C
Change line
cc
Delete forward one word
dw
Delete back one word
db
Delete to word end
de
Delete forward one WORD
dW
Delete back one WORD
dB
Delete to WORD end
dE
Change forward one word
cw
Change back one word
cb
Change to word end
ce
Change forward one WORD
cW
Change back one WORD
cB
Change to WORD end
cE
Delete to line start
d0
Delete to first non-blank
d^
Change to line start
c0
Change to first non-blank
c^
Delete up to first line
dgg
Delete down to last line
dG
Change up to first line
cgg
Change down to last line
cG
Undo last change
u
Repeat last command
.
Vim mode find, yank and paste 17
Action
Shortcut
Find character forward
f{char}
Find character backward
F{char}
Jump to just before next match
t{char}
Jump to just after previous match
T{char}
Repeat character find
;
Repeat find in reverse
,
Delete character before cursor
X
Toggle case under cursor
~
Replace character under cursor
r{char}
Yank line
yy
Yank to line end
Yory$
Yank word
yw
Yank WORD
yW
Yank to word end
ye
Yank to WORD end
yE
Paste after cursor
p
Paste before cursor
P
Slash commands for sessions and context 24
Action
Shortcut
Browse and resume sessionsOpens the session browser for automatically saved conversations; checkpoint subcommands hang off the same command.
/resume
Alias of /resumeKept as a second name: it opens the same session browser and takes the same checkpoint subcommands.
/chat
List saved checkpointsCheckpoints are project-scoped, so tags from other project directories do not appear.
/resume list
Save a tagged checkpointStores the conversation so far under the tag you give; the tag is required.
/resume save TAG
Load a tagged checkpointOnly checkpoints saved in the same project can be loaded; /resume load is an alias.
/resume resume TAG
Delete a tagged checkpoint
/resume delete TAG
Export the conversationGive a .md or .json name for Markdown or JSON; without a name the CLI generates one.
/resume share FILENAME
Clear context and screenWipes the conversation context as well as the display, unlike Ctrl + L, which only redraws the UI.
/clear
Summarise the chat contextReplaces the whole context with a summary, which saves tokens on later tasks.
/compress
Rewind the conversationPick an earlier interaction, then rewind the history, revert the code changes, or both.
/rewind
List restorable checkpointsRun with no tool call ID; it needs checkpointing to be configured in settings.
/restore
Restore files to a checkpointPuts project files back as they were just before that tool call ran, undoing its edits.
/restore TOOL_CALL_ID
Copy the last outputUses pbcopy, xclip or clip locally and OSC 52 in SSH or WSL sessions.
/copy
Show the loaded contextPrints the combined text of every GEMINI.md file currently in use.
/memory show
Reload GEMINI.md context files/memory refresh does the same re-scan of all context files.
/memory reload
List loaded context file paths
/memory list
Generate a GEMINI.md fileAnalyses the current directory and writes a context file tailored to the project.
/init
Add workspace directoriesSeveral paths can be given at once, separated by commas; /dir is the short name.
/directory add PATH
List workspace directoriesCovers folders added with /directory add as well as with --include-directories.
/directory show
Switch to Plan ModePlan Mode is read-only; the command also shows the current plan when one exists.
/plan
Plan toward a stated goalSwitches to Plan Mode and submits the text straight away as the prompt.
/plan GOAL
Copy the approved plan
/plan copy
Exit Gemini CLI/exit is accepted as another name for it.
/quit
Exit and erase the sessionAlso wipes the chat recording, tool outputs and other history of this session for good.
/quit --delete
Slash commands for tools and extensions 32
Action
Shortcut
List available tools
/tools
List tools with descriptionsEach name comes with the full description that is handed to the model; descriptions is the long spelling.
/tools desc
List tool names only
/tools nodesc
List MCP servers and toolsListing is the default action; enable, disable and schema are further subcommands.
/mcp
List servers with descriptions
/mcp desc
Sign in to an MCP serverBegins OAuth sign-in for the named server; leave the name out to see which servers offer OAuth.
/mcp auth SERVER-NAME
Reload MCP serversRestarts the servers and discovers their tools again.
/mcp reload
Manage extensionsSubcommands include list, install, update, enable, disable, link, uninstall, explore and config.
/extensions
Reload active extensions
/extensions reload
Manage Agent SkillsSubcommands are list, enable, disable and reload.
/skills
Enable a skill
/skills enable NAME
Disable a skill
/skills disable NAME
Reload discovered skillsRescans the workspace, user and extension tiers for skills.
/skills reload
List subagentsShows local and remote agents along with the built-in ones.
/agents list
Reload the agent registryRescans ~/.gemini/agents and .gemini/agents; refresh is an alias.
/agents reload
Enable a subagent
/agents enable AGENT-NAME
Disable a subagent
/agents disable AGENT-NAME
Configure a subagentOpens a dialog for the agent's model, temperature and execution limits.
/agents config AGENT-NAME
View registered hooksShows every hook with its status; list and show open the same view.
/hooks panel
Enable all hooks
/hooks enable-all
Disable all hooks
/hooks disable-all
Enable one hook
/hooks enable NAME
Disable one hook
/hooks disable NAME
List custom command filesLists .toml files from the user folder, the project folder and active extensions.
/commands list
Reload custom commandsRun it after adding or editing a .toml file so no restart is needed.
/commands reload
Check the IDE connection
/ide status
Install the IDE companion
/ide install
Turn on IDE integration
/ide enable
Turn off IDE integration
/ide disable
Manage folder trust
/permissions trust DIRECTORY-PATH
List active policiesPolicies are shown grouped by mode.
/policies list
Open background shells view/bashes is a second name for the same view of long-running background processes.
/shells
Slash commands for settings and help 19
Action
Shortcut
Show command helpLists the available commands and how to use them; /? is the short form.
/help
Show version infoUseful to paste into an issue report.
/about
Change the sign-in methodOpens a dialog for choosing a different authentication method.
/auth
File an issueText typed after the command becomes the headline of the issue, filed on GitHub by default.
/bug
Open the documentationOpens the Gemini CLI docs in your browser.
/docs
Choose an external editorOpens a dialog listing the supported editors.
/editor
Manage model configurationHas two subcommands: manage opens a dialog and set takes a model name.
/model
Open the model dialog
/model manage
Set the model by nameThe usage line also accepts an optional --persist flag.
/model set MODEL-NAME
Open the settings editorEdits the same values as .gemini/settings.json, with validation; some changes need a restart.
/settings
Change the visual theme
/theme
Toggle vim modeThe setting is saved to ~/.gemini/settings.json and the footer shows [NORMAL] or [INSERT].
/vim
Show session statisticsDefaults to the session view, with duration, tool-call and performance figures.
/stats
Show per-model usageIncludes token counts and quota information.
/stats model
Show per-tool usage
/stats tools
Show the Privacy NoticeAlso lets you choose whether to consent to data collection for service improvement.
/privacy
Set up multiline keybindingsConfigures terminal keybindings for multiline input in VS Code, Cursor and Windsurf.
/terminal-setup
Set up GitHub ActionsSets up workflows in which Gemini triages issues and reviews pull requests.
/setup-github
Open the upgrade pageOpens the Gemini Code Assist page in a browser; only offered when logged in with Google.
/upgrade
Installing and starting 10
The cheatsheet also lists gemini update, but the help output of release 0.63.0 has no update command; reinstall the npm package with the @latest tag to upgrade.
Action
Shortcut
Install with npmGlobal install; add @latest, @preview or @nightly to the package name to choose a release channel.
npm install -g @google/gemini-cli
Run without installing
npx @google/gemini-cli
Install with HomebrewThe Homebrew package is offered for macOS and Linux.
brew install gemini-cli
Start an interactive session
gemini
Start with an opening promptThe query is answered first and the session then stays interactive.
gemini QUERY
Run one prompt and exitNon-interactive (headless) mode; --prompt is the long form, and the prompt is appended to anything piped on stdin.
gemini -p QUERY
Run a prompt, then stay interactiveLong form --prompt-interactive; it cannot be combined with input piped on stdin.
gemini -i QUERY
Pipe content into GeminiPowerShell users pipe with Get-Content in place of cat.
cat FILE | gemini
Print the version number
gemini --version
Show command-line help
gemini --help
Command-line options 17
Action
Shortcut
Choose the modelLong form --model; takes an alias (auto, pro, flash, flash-lite) or a concrete model name.
gemini -m MODEL
Ask before each tool callThis is the mode the CLI starts in when no flag is given.
gemini --approval-mode default
Auto-approve edit toolsEdits are applied without asking; other tool calls still prompt.
gemini --approval-mode auto_edit
Auto-approve every tool callReplaces the deprecated --yolo (-y) flag.
gemini --approval-mode yolo
Start in read-only Plan ModeThe Plan Mode guide also writes it with an equals sign, --approval-mode=plan.
gemini --approval-mode plan
Run in a sandboxShort form -s; tools then execute inside a sandboxed environment.
gemini --sandbox
Trust this workspace onceSkips the folder trust check for the current session only.
gemini --skip-trust
Work in a fresh git worktreeShort form -w; a name is generated if none is given, and experimental.worktrees must be enabled in settings.
gemini --worktree NAME
Add directories at launchComma-separated list, or repeat the flag; the configuration reference caps it at five directories.
gemini --include-directories DIRECTORIES
Load only named extensionsLong form --extensions; repeat the flag for several, and without it every extension is used.
gemini -e EXTENSION_NAME
Start with extensions disabled
gemini -e none
List extensions and exit
gemini --list-extensions
Restrict MCP serversOnly the named servers are allowed for the session; separate several with commas.
gemini --allowed-mcp-server-names NAMES
Print the result as JSONMeant for non-interactive runs; -o is the short form.
gemini --output-format json
Stream events as JSONEmits newline-delimited JSON events in real time while the run is in progress.
gemini --output-format stream-json
Run with verbose loggingShort form -d; F12 opens the debug console where the extra output appears.
gemini --debug
Enable screen reader mode
gemini --screen-reader
Sessions from the command line 8
Action
Shortcut
Resume the latest sessionShort form -r; with no value the newest session is the one loaded.
gemini --resume
Resume a session by indexIndex numbers come from the --list-sessions output.
gemini --resume INDEX
Resume by ID with a prompt
gemini -r SESSION-ID QUERY
Continue with a new promptReopens the most recent session and sends the query to it.
gemini -r latest QUERY
List saved sessionsPrints the sessions of the current project with their index numbers, then exits.
gemini --list-sessions
Delete a saved sessionTakes the index number shown by --list-sessions, or the session ID.
gemini --delete-session INDEX
Start with a chosen session ID
gemini --session-id UUID
Load a session from JSON
gemini --session-file FILE
Extension commands 15
Action
Shortcut
Install an extensionThe source is a Git URL or a local path.
gemini extensions install SOURCE
Install from a branch, tag or commit
gemini extensions install SOURCE --ref REF
Install with auto-update on
gemini extensions install SOURCE --auto-update
Allow pre-release versions
gemini extensions install SOURCE --pre-release
Skip the install confirmationAcknowledges the security risks up front, so no prompt appears.
gemini extensions install SOURCE --consent
Uninstall extensionsSeveral names can be given in one command.
gemini extensions uninstall NAME
List installed extensions
gemini extensions list
Update one extension
gemini extensions update NAME
Update every extension
gemini extensions update --all
Enable an extension
gemini extensions enable NAME
Disable an extension
gemini extensions disable NAME
Link a local extensionFor development: changes made in the local path are always reflected.
gemini extensions link PATH
Create an extension from a templateA template name can follow the path, for example mcp-server, hooks or custom-commands.
gemini extensions new PATH
Validate an extension
gemini extensions validate PATH
Configure an extension settingBoth arguments are optional; --scope chooses user or workspace.
gemini extensions config NAME SETTING
MCP server, skill and hook commands 20
Action
Shortcut
Add a stdio MCP serverEverything after the name is the command that launches the server; stdio is the default transport.
gemini mcp add NAME COMMAND
Add an HTTP MCP serverTransport can be stdio, sse or http; stdio is the default.
gemini mcp add NAME URL --transport http
Set server environment variables
gemini mcp add NAME COMMAND --env KEY=value
Save the server in user scopeWithout the flag the server is saved in the project scope.
gemini mcp add NAME COMMAND --scope user
Expose only selected tools
gemini mcp add NAME COMMAND --include-tools TOOL1,TOOL2
Trust the serverTool calls from this server skip every confirmation prompt.
gemini mcp add NAME COMMAND --trust
Send an HTTP headerShort form -H; repeat it for each header, for SSE and HTTP transports only.
gemini mcp add NAME URL --header HEADER
Remove an MCP serverActs on the project scope unless --scope user is added.
gemini mcp remove NAME
List configured MCP servers
gemini mcp list
Enable an MCP server
gemini mcp enable NAME
Disable an MCP server
gemini mcp disable NAME
Disable for this session only
gemini mcp disable NAME --session
List discovered skills
gemini skills list
Include built-in skills
gemini skills list --all
Install a skillSource can be a Git repository, a local path or a file; --scope picks user or workspace.
gemini skills install SOURCE
Link local skillsCreates a symlink, so later changes in the source folder show up at once.
gemini skills link PATH
Uninstall a skill
gemini skills uninstall NAME
Enable a skill from the shell
gemini skills enable NAME
Disable a skill from the shell
gemini skills disable NAME
Migrate hooks from Claude Code
gemini hooks migrate --from-claude
No row on this page matches that filter.
Notes
Prompting and history
Enter submits, and a newline needs a modifier: Ctrl + Enter, Alt + Enter, Shift + Enter or Ctrl + J. Ctrl + R starts a reverse search through your prompt history, and Ctrl + P and Ctrl + N step to the previous and next entries. Tab queues the current prompt so it runs after the task in progress, which is useful when you know the next instruction before the model is done. Ctrl + O expands a paste placeholder under the cursor; outside alternate buffer mode it also expands or collapses long blocks of output.
Approval modes and YOLO
Shift + Tab cycles the approval mode (default, auto-edit, plan) that decides whether the CLI asks before running tools and editing files; Ctrl + Y toggles YOLO mode, where every tool call is approved automatically. The same modes can be chosen at launch, for example gemini --approval-mode auto_edit or gemini --approval-mode plan. YOLO is fine for a scratch directory and a bad idea in a repository with uncommitted work: the /restore command can roll back file edits from a checkpoint, but only if checkpointing is configured. Esc, Esc (Escape twice) clears the current input, or opens the rewind view when the prompt is empty, and /rewind opens that view directly.
Shell mode and the editor
Typing ! on an empty prompt toggles shell mode, in which each line runs as a shell command; a one-off such as !ls -la runs a single command and returns to the session, which saves leaving it for a quick git status. Ctrl + G opens the current prompt in your external editor for longer instructions, and Ctrl + T shows or hides the full TODO list. Ctrl + C cancels the current request, or quits the CLI when the input is empty, and Ctrl + D exits at an empty prompt.
Questions
How do I write a multi-line prompt?
Ctrl + Enter, Alt + Enter, Shift + Enter and Ctrl + J insert a newline; Enter alone submits. Ending a line with a backslash before Enter also works. For anything long, Ctrl + G opens the prompt in your editor.
What does YOLO mode do?
It approves every tool call automatically, so tools run and files change without confirmation. Ctrl + Y toggles it during a session, and gemini --approval-mode yolo starts the CLI in it.
Where is the built-in list of shortcuts?
Type ? at an empty prompt to open the shortcuts panel, or run /help for slash commands.
How do I run a shell command without leaving the session?
Start the line with ! (for example !ls -la) and it executes in the shell instead of being sent to the model. Typing ! on its own toggles shell mode.
How do I pick up the previous Gemini CLI session?
gemini --resume reopens the most recent session, gemini --resume INDEX takes a number from gemini --list-sessions, and inside the CLI /resume opens the session browser.
Can the default key bindings be changed?
Yes. Add entries to ~/.gemini/keybindings.json, each with a command name from the shortcut reference and a key; a minus sign in front of the command name removes a default binding.