Skip to content
OVEX TECH
Education & E-Learning

Master Gemini CLI Commands and Settings Easily

Master Gemini CLI Commands and Settings Easily

Unlock the Power of Gemini CLI: Commands and Settings Guide

The Gemini Command Line Interface (CLI) offers a rich set of built-in commands that streamline your workflow and allow for deep customization. This guide will walk you through understanding and utilizing these commands, from basic chat management to fine-tuning your CLI experience through settings.

What You’ll Learn

In this tutorial, you will discover how to:

  • Identify and execute built-in Gemini CLI commands.
  • Manage chat sessions, including saving, listing, and resuming conversations.
  • Utilize helpful commands like `help`, `docs`, `copy`, and `clear`.
  • Understand and modify the CLI’s behavior using global and workspace settings.
  • Explore advanced features like managing directories and refreshing agent memory.

Understanding Gemini CLI Commands

In Gemini CLI, as with other agentic CLI tools, commands are identified by a forward slash (/) prefix. Typing a single forward slash into the chat input will reveal a comprehensive list of all available built-in commands, each with a brief description.

  1. Accessing the Command List

    To see all available commands, simply type / into the chat input and press Enter. You can navigate through the list using the up and down arrow keys.

  2. Running a Command

    Once you’ve selected a command (e.g., by navigating to it and pressing Enter), it will be inserted into the chat input. To execute the command, you need to press Enter again.

Key Built-in Commands and Their Uses

1. The help Command

The help command provides hints, information, and details about other commands and shortcuts. Execute it by typing /help and pressing Enter twice.

2. Managing Chat Sessions with the chat Command

The chat command is your tool for managing conversations with Gemini.

  1. Viewing Subcommands

    Type /chat and press Enter to see a list of subcommands such as list, save, resume, delete, and share.

  2. Listing Saved Conversations

    To see your saved chat sessions, select the list subcommand: type /chat list and press Enter.

  3. Saving the Current Conversation

    To save your current chat session, you need to provide a name (a “tag”).

    1. Type /chat save.
    2. Add a descriptive tag, for example: initial project setup. The full command would look like /chat save initial project setup.
    3. Press Enter twice to execute. This saves the conversation at its current point, allowing you to resume later.

    Expert Note: The save command requires a tag. Without it, you’ll receive an error indicating a missing argument.

  4. Resuming a Conversation

    To resume a previously saved conversation, you would use the resume subcommand followed by the tag you used when saving it (e.g., /chat resume initial project setup).

3. Other Useful Commands

  • /orth: Used for changing authentication methods. This will be relevant when setting up API tokens.
  • /bug: Report bugs directly within the CLI.
  • /clear: Clears the entire chat history for the current session.
  • /copy: Copies the most recent model output to your system clipboard.
  • /docs: Opens the Gemini CLI documentation in your default web browser.
  • /directory: Manages workspace directories. You can add directories to your project, allowing Gemini to analyze and work within multiple project folders simultaneously.
  • /quit: Exits the current Gemini CLI session.
  • /model: Allows you to switch between different AI models. The default is auto, which selects the best model for the task. (Note: Gemini 3 might require an API key if not yet rolled out to your account.)
  • /stats: Displays current model and tool usage statistics, including API requests and token consumption.
  • /theme: Change the visual color theme of the Gemini CLI. Navigate the options and press Enter to select. Press Esc to exit the theme selection.

4. Managing Agent Memory with the memory Command

The memory command allows you to influence what the Gemini agent remembers.

  1. Refreshing Memory

    Use the refresh subcommand (/memory refresh) to make the agent rescan for new Gemini configuration files (.md files) in your project and global configuration directories.

  2. Adding Global Instructions

    You can add instructions that apply across all your projects.

    1. Type /memory add followed by your instruction. For example: /memory add I prefer using shard CN as a UI component library where possible.
    2. Press Enter. This instruction is saved to your global .gemini/config.json file, affecting all future sessions.

    Warning: Changes made via /memory add using the global scope affect all your projects. Be mindful of the scope when adding instructions.

  3. Listing Memory Files

    To see which configuration files are currently being used for memory, use the list subcommand: /memory list.

  4. Showing Combined Instructions

    The show subcommand (/memory show) displays all instructions aggregated from the currently active configuration files.

Customizing Gemini CLI with Settings

The settings command allows you to fine-tune various aspects of the Gemini CLI’s behavior.

Accessing and Modifying Settings

  1. Opening the Settings Menu

    Type /settings and press Enter. This opens a menu with numerous options you can toggle.

  2. Understanding Setting Scopes

    At the bottom of the settings menu, you’ll see options to apply changes to different scopes:

    • User Settings (Global): These are stored in ~/.gemini/settings.json and apply to all your Gemini CLI sessions across all projects.
    • Workspace Settings (Local): These apply only to the current project.
  3. Changing the Scope

    To switch between scopes, use the Tab key. Focus will move to the scope selection menu. Navigate with arrow keys and press Enter to select.

  4. Toggling Settings

    Navigate to the desired setting in the top menu (e.g., hide banner or show model info in chat) and press Enter to toggle its value (e.g., between true and false).

Example: Setting Workspace-Specific Options

  1. Ensure your scope is set to Workspace Settings (use Tab to switch if necessary).

  2. Navigate to the show model info in chat setting.

  3. Press Enter to toggle it to true.

When you apply a setting to the workspace scope, Gemini CLI automatically creates a .gemini folder in your project’s root directory and adds a settings.json file within it. This file will only contain the settings that differ from their default values. This ensures that your project-specific configurations do not interfere with your global preferences.

Understanding Setting Cascading

Settings are applied in a hierarchical manner. Global settings form the base, and workspace settings can override them. If a setting is configured both globally and locally, the local (workspace) setting takes precedence. You can also manually edit these settings.json files to add or modify settings.

Exiting Command Menus

To exit most command menus or selections and return to the standard chat input, press the Esc key.

By mastering these commands and settings, you can significantly enhance your productivity and tailor the Gemini CLI to your specific development needs.


Source: Gemini CLI Tutorial #4 – Commands & Settings (YouTube)

Leave a Reply

Your email address will not be published. Required fields are marked *

Written by

John Digweed

1,380 articles

Life-long learner.