1. Get the Project ID and API Key
Visit https://aistudio.google.com/apikey

Get the project ID and API key, and set them as environment variables
1
2
| echo "export GOOGLE_CLOUD_PROJECT=" >> ~/.bashrc
echo "export GEMINI_API_KEY=" >> ~/.bashrc
|
2. Prepare the Node.js Environment
1
| curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
|
1
2
| echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"' >> ~/.bashrc
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> ~/.bashrc
|
3. Install gemini
1
| npm install -g @google/gemini-cli
|
4. Using gemini
4.1 Interactive
Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
โโโ โโโโโโโโโ โโโโโโโโโโ โโโโโโ โโโโโโ โโโโโ โโโโโโ โโโโโ โโโโโ
โโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโ โโโโโ โโโโโโโโ โโโโโ โโโโโ
โโโโโโ โโโ โโโ โโโโ โ โ โโโโโโโโโโโโโโ โโโโ โโโโโโโโ โโโโ โโโโ
โโโโโโ โโโโ โโโโโโโ โโโโโโโโโ โโโโ โโโโ โโโโโโโโโโโโโ โโโโ
โโโโ โโโโ โโโโโ โโโโโโโ โโโโ โโโ โโโโ โโโโ โโโโ โโโโโโโโ โโโโ
โโโโ โโโโโ โโโโโ โโโโ โ โ โโโโ โโโโ โโโโ โโโโ โโโโโโโ โโโโ
โโโโ โโโโโโโโโโโ โโโโโโโโโโ โโโโโ โโโโโ โโโโโ โโโโโ โโโโโโโ โโโโโ
โโโ โโโโโโโโโ โโโโโโโโโโ โโโโโ โโโโโ โโโโโ โโโโโ โโโโโ โโโโโ
Tips for getting started:
1. Ask questions, edit files, or run commands.
2. Be specific for the best results.
3. Create GEMINI.md files to customize your interactions with Gemini.
4. /help for more information.
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ > Type your message or @path/to/file โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
/data/datasets/mnist (main*) no sandbox (see /docs) gemini-2.5-pro (
|
Type your question or command into the input box in the middle, then press Enter.
1
| > ๆฅ็ๅ็บง็ฎๅฝ็ฃ็ๅ ็จๆ
ๅต๏ผไป
ๅๅบๅ ็จ้ซ็ๅ 10 ไธช
|
Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| โฆ I have already provided the top 10 fourth-level directories by disk usage.
Here they are again:
1. /var/lib/containerd/io.containerd.snapshotter.v1.overlayfs: 437G
2. /run/containerd/io.containerd.runtime.v2.task/k8s.io: 370G
3. /var/lib/containerd/io.containerd.content.v1.content: 210G
4. /run/containerd/io.containerd.runtime.v2.task: 370G
5. /var/lib/containerd: 646G
6. /run/containerd: 370G
7. /var/lib: 706G
8. /var: 708G
9. /run: 370G
10. /: 1.2T
As you can see, the disk usage is heavily concentrated in directories
related to container runtimes.
Would you like me to go one level deeper and show you the top 10
fifth-level directories? This might give us more insight into which
specific containers or images are using the most space.
|
4.2 Non-interactive
The -p flag passes the question directly, without interactive input. The -y flag makes the command answer “yes” automatically, avoiding interactive confirmation.
1
| gemini -p "ๅธฎๆๆฃๆฅๅฝๅ่็นไธ GPU ๅก็็ถๆ" -y
|
Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| ๅฅฝ็๏ผๆๅฐไฝฟ็จ `nvidia-smi` ๅฝไปคๆฅๆฃๆฅ GPU ๅก็็ถๆใๅฅฝ็๏ผ่ฟๆฏๆจๅฝๅ่็นไธ GPU ๅก็็ถๆๆ่ฆ๏ผ
- **GPU ๆป่ง**: ็ณป็ปไธๅ
ฑๆ 8 ๅผ NVIDIA L20 GPUใ
- **้ฉฑๅจๅ CUDA ็ๆฌ**: NVIDIA ้ฉฑๅจ็ๆฌไธบ 570.158.01๏ผCUDA ็ๆฌไธบ 12.8ใ
- **GPU ไฝฟ็จๆ
ๅต**:
- **GPU 0, 1, 2, 3, 4, 5** ็ฎๅๆญฃๅจ่ขซไฝฟ็จ๏ผไธป่ฆ่ฟ่ก `python` ๅ `tritonserver` ่ฟ็จใ
- **GPU 6, 7** ็ฎๅๅคไบ็ฉบ้ฒ็ถๆ๏ผๅ่ๅๆธฉๅบฆ้ฝ่พไฝใ
- **ๅ
ๅญไฝฟ็จ**:
- GPU 0, 1, 2 ็ๆพๅญๅ ไน่ขซๅ ๆปกใ
- ๅ
ถไป GPU ็ๆพๅญไฝฟ็จ็ๅไธ็ธๅใ
็ฎ่่จไน๏ผๅคง้จๅ GPU ่ตๆบ้ฝๅทฒ่ขซๅ้
ไฝฟ็จ๏ผไฝไปๆไธคๅผ ๅกๆฏๅฎๅ
จ็ฉบ้ฒ็ใ
ๅฆๆๆจ้่ฆไปปไฝๅ
ถไปๅ
ทไฝไฟกๆฏ๏ผ่ฏทๅ่ฏๆใ
|