An AI Terminal Assistant

Running Shell Commands

Gemini CLI also lets you run regular Linux commands. To do this, you need to prefix a command with ! (Figure 4), and then Gemini CLI executes the command in your local shell:

> !ls -al
Figure 4: Gemini CLI can also run Linux commands just like a native terminal.

If you need to switch back from the shell mode, just enter ! or hit the Esc key. As a result, you rarely need to switch out of the CLI environment when running general prompts and commands simultaneously.

Working with Local Files

Another interesting Gemini CLI feature is the ability to work on files such as scripts, configs, source code, etc. To attach a file, you append an @ symbol before the file name in your prompt as shown in Figure 5. If the files are in a different directory, you can modify the prompt by giving a full path for the file as shown in Figure 6.

Figure 5: Gemini CLI can also summarize a text file if you insert an @ symbol before the file name.
Figure 6: The @ symbol also lets you work on files in different directories.

Built-In Tools

Gemini offers many built-in tools to make your work easier. To see a list of available tools, enter

> /tools

Figure 7 shows a list of tools that can help you with writing files, reading content, or generating structured output. For example, the prompt in Figure 8 will search for a text string inside a specific file.

Figure 7: Gemini CLI's available tools.
Figure 8: Gemini CLI invokes the ReadFile tool to read the file mentioned in the prompt.

Buy this article as PDF

Download Article PDF now with Express Checkout
Price $2.95
(incl. VAT)

Buy Linux Magazine

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News