Skip to content

Master Your Workflow: Top Gemini CLI Commands You Should Know

I've always been a terminal dweller. There's something uniquely satisfying about staying in the command line, but as my workflows grew, I found myself constantly context-switchingโ€”jumping to the browser to check docs, to a GUI for Git, and back. It was a focus killer.

That changed when I started integrating the Gemini CLI into my daily routine. Instead of leaving the terminal, I now have Google's AI models directly in my command line as a context-aware pair programmer. It's drastically streamlined my workflow, and I wanted to share the commands I find most useful.

๐Ÿš€ Getting Started: The Essentials

Here are the foundational commands I use to get oriented in a new project.

  • /init ๐ŸŽฌ: This is where your journey should begin. Running /init in your project directory allows Gemini to analyze your codebase and create a GEMINI.md file.

  • /about โ„น๏ธ: Curious about your setup? This command quickly displays your Gemini CLI version, the underlying model being used, and your current authentication method.

  • /auth ๐Ÿ”‘: Security and access are paramount. The /auth command lets you configure how you authenticate with Google's AI services.

  • /help & /docs ๐Ÿ“š: The /help command is your go-to for a quick overview. For more details, /docs opens the full documentation in your browser.

  • /quit ๐Ÿ‘‹: When you're done for the day, simply use /quit to exit the Gemini CLI application.

๐Ÿ› ๏ธ Core Workflow Commands

These are the commands you'll use day-to-day to interact with Gemini and your codebase.

  • ! (Shell Commands) ๐Ÿš: This is one of the most powerful features. Press SHIFT + 1 to enter "shell mode," allowing you to execute shell commands or describe them in natural language.

  • /tools ๐Ÿงฐ: Ever wonder what capabilities Gemini has? The /tools command lists all available tools Gemini can use to help you.

  • /editor โœ๏ธ: Pro-Tip: For complex, multi-line prompts, use /editor to set your preferred external editor (like Vim or VS Code), then use Ctrl+X to open it.

๐Ÿ’ฌ Managing Your Conversations

A conversation with Gemini is a valuable asset. Here's how to manage it effectively.

  • /chat (save, resume, list, delete, share) ๐Ÿ’พ: The /chat command is a powerful tool for managing your session history. save a conversation, resume it later, or share it as a file.

  • /clear ๐Ÿงน: Need a fresh start? /clear will wipe the screen and your current conversation history.

  • /compress ๐Ÿง : When a conversation gets long, /compress intelligently summarizes the context to keep things focused.

๐ŸŽจ Customization and Stats

Tailor the CLI to your liking and keep an eye on your usage.

  • /theme ๐Ÿ–Œ๏ธ: Customize your experience. The /theme command allows you to change the look and feel of the Gemini CLI.

  • /stats ๐Ÿ“Š: Curious about your usage? /stats provides statistics for your current session, including model and tool usage.

โŒจ๏ธ Gemini CLI Keyboard Shortcuts You Should Know

To work even faster, it's worth learning a few essential keyboard shortcuts.

  • ESC: Cancel a long-running task or clear your input.
  • Ctrl+C: Quit the application (press twice).
  • Ctrl+X / Meta+Enter: Open your input in an external editor.
  • Enter: Send your query to Gemini.

โœจ Common Use Cases to Try Today

Here are a few practical ideas to get you started:

  • Quick Refactoring: Use @ to provide a file as context (e.g., @src/utils.py) and ask Gemini: "Refactor the calculate_total function in this file to be more readable."
  • Commit Message Generation: Run !git diff --staged and then ask Gemini: "Based on the diff, write a conventional commit message."
  • Command-Line Coach: Paste a complex shell command and ask: tar -xzvf archive.tar.gz "What do each of these flags do?"
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ >   tar -xzvf archive.tar.gz what does each flag do                                                                                             โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

โœฆ Of course. The command tar -xzvf archive.tar.gz is used to decompress and extract files from a gzipped tar archive.

  Here is a breakdown of what each flag does:

   * -x: eXtract. This tells tar to get files out of the archive.
   * -z: gZip. This tells tar to decompress the archive using gzip. This is necessary for files ending in .gz.
   * -v: Verbose. This makes tar list each file as it is being extracted, so you can see the progress.
   * -f: File. This flag must be followed by the name of the archive file you want to process (in this case, archive.tar.gz).

  You can think of the command as saying: "eXtract the gZipped contents Verbosely from the File named archive.tar.gz."

Final Thoughts

Integrating these commands took a bit of muscle memory at first, but it's vastly improved how I work day-to-day. If you're also trying to maximize your terminal time, I definitely recommend giving some of these a shot.

What does your terminal setup look like? I'm always looking for ways to optimize my workflow, so let me know if you have any favorite CLI tricks.