A student friendly guide to install Gemini CLI and use it daily for coding, debugging, file based context, command piping, project rules, and automation.
Gemini CLI runs through Node.js. You will install Node.js first, then install Gemini CLI using npm. This tutorial assumes Windows + PowerShell.
System requirements
Gemini CLI is installed with npm, and npm comes with Node.js. Use Node.js LTS.
Check if Node.js is already installed
node --version
npm --version
Install Gemini CLI globally. This makes the gemini command available everywhere.
npm install -g @google/gemini-cli
Verify installation
gemini --version
Sometimes Windows does not find npm global commands immediately. If gemini --version fails, add npm global path to your session.
$env:Path += ";C:\Users\<YOUR-USERNAME>\AppData\Roaming\npm"
gemini --version
Login connects Gemini CLI to your Google account. This is usually one time only.
gemini auth login
Interactive mode is like a chat session, but it can read files and accept piped text.
gemini
Useful inside chat
/clear
/reset
/exit
The symbol @ means: read this file and include it as context. This is the key advantage over browser chat.
Explain a Python script
@script.py Explain this code step by step
Compare two versions
@v1.py @v2.py What is the difference between these scripts?
Wildcard example (small folder only)
@*.txt Summarize these notes into one paragraph
Piping lets you send output from any command directly into Gemini. This avoids copy and paste. It is ideal for logs, Git diffs, and system diagnostics.
Explain an error log
Get-Content error.log | gemini "What caused this error and how do I fix it?"
Write a Git commit message
git diff | gemini "Write a concise commit message for these changes"
Find memory heavy processes
Get-Process | gemini "Which top 3 apps use the most memory? Explain briefly."
You can set custom instructions per project. Gemini CLI automatically reads GEMINI.md from the current folder.
Create a project folder
mkdir C:\Users\mahbu\MyCodingProject
cd C:\Users\mahbu\MyCodingProject
Create GEMINI.md
# GEMINI.md
You are a strict senior Python reviewer.
Prefer efficient code.
Point out bugs and edge cases.
Be concise and practical.
You can run a single prompt and exit immediately. This is useful for scripts and quick tasks.
gemini "Write a professional email saying I will be 10 minutes late to the meeting"
| Goal | Command | Example |
|---|---|---|
| Start chat | gemini | Interactive session |
| Read file | @filename | @data.csv Analyze this |
| Read many files | @*.py | Find bugs in these scripts |
| Pipe output | command | gemini "prompt" | git diff | gemini "commit msg" |
| One line ask | gemini "text" | Quick help then exit |
| Clear screen | /clear | Inside chat mode |
| Reset session | /reset | Inside chat mode |
| Exit | /exit | Inside chat mode |
This short task proves that Gemini CLI can analyze real system output.
Get-Process | gemini "Identify the top 3 memory consuming processes. Explain what each likely does."