This one tool will help you master the Android terminal emulator Termux

https://www.profitableratecpm.com/f4ffsdxe?key=39b1ebce72f3758345b2155c98e6709c

Termux is great, but the only thing that slowed me down (or at least accustomed slow me down) had to search for documentation or commands. So I found a way to integrate an AI assistant (not a coding agent) into Termux. I can now search for commands and search for items on the fly without leaving the terminal.

How it works

I installed a script that allows me to use the CLI versions of Google Gemini or ChatGPT in Termux. Accessing it is as easy as typing aifollowed by a request. For example, if I want to know which command updates repositories and packages in Termux, I could give it a prompt like this.

The CLI tool only prints the commands I need. You can also request similar commands to install any other packages. You can ask this cli tool to give you curl Or wget commands to load scripts or configuration files. For example, I could ask it for a script that customizes the Termux theme.

This also comes in handy if you want the AI ​​to write small scripts for you without launching a coding agent like Gemini CLI (which Termux can also do). Just type aispecify what you want the script to do and what language you want it to be in. Then type > and the name of the script file. When you press Enter, the new script will be created in the same directory. For example, you can ask the AI ​​to write a Bash script to generate random passwords.

ai write a small bash script for generating a random password>pass.sh

Then you can run it with Bash command like this.

bash pass.sh

Scripts also don’t have to be so simple or trivial. For example, you can create a Python script that scours Reddit or LinkedIn for job leads and produces the result in a CSV file.

When working with Termux, you will inevitably come across scripts that other people have written and that you want to use. This handy tool can also help you understand these scripts, debug them, and even scan them for malicious code. All you have to do is cat this script and send it to ai fast.

cat pass.sh | ai what does this script do?
The CLI tool can explain what a script does.

The cat command displays the contents of the file and the pipe | do not touch the outlet of cat At ai order. You can also do the same for error logs or configuration files.

How to configure AI assistant in Termux

You’ll need three things to make things work.

  1. Termux. Install the Termux app from F-Droid or GitHub as the Play Store version is severely limited.

  2. An API key from Google Gemini or OpenAI. The Gemini API key is free with limited use.

  3. The Git tool to retrieve the installation script. Be sure to always review a script before running it.

Once you have installed Termux, open the application and run this command to update repositories and packages.

pkg update && pkg upgrade -y

We can now install git.

pkg install git

We are ready to install the CLI wizard tool. Here is the GitHub repository link for the tool. Let’s start by creating a new folder and jumping into it.

mkdir ai
cd ai

Next, we will use the git tool to clone the repository.

git clone https://github.com/estiaksoyeb/termai

Let’s enter this repository and run the installer.

cd termai
bash install.sh
Installing the AI ​​Assistant tool with Termux.

You should see a message stating that “termai” was installed successfully. The script automatically clears cloned directories, so you don’t have to worry about manual cleaning. Just press “Y” and press Enter when prompted.

With the CLI tool installed globally, all we need now is the API key to activate it. Let’s try to use the ai order.

ai hello

When you first run it, you will be asked which AI model you want to use. Press 1 for Gemini and 2 for OpenAI. Next, open Google’s AI Studio website and sign in with a Google account. Find the “Get API Key” button and tap it. Create a new project here and copy the API key.

Return to Termux and paste the Gemini API key where requested. As long as the API key is correct and you have free tokens, you can access Gemini in Termux. You can follow the query with or without quotes to get a response.

If you want to change the API key later or want to change the system prompt, you can modify the configuration file with this command.

ai --config
Configuration of the AI ​​tool in Termux.

To remove the tool and its configuration files, you can run these three commands.

rm $PREFIX/bin/ai
rm -rf ~/.programs/termai
rm -rf ~/.local/share/termai

Now you have a handy little wizard to extract commands and get help with errors. This tool can also help you understand scripts and error logs. He can even write scripts.

Related Articles

Leave a Reply

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

Check Also
Close
Back to top button