Yahoo
Skip to main content
Advertisement
Advertisement
Advertisement
Advertisement

4 more awesome (and practical) things you can do with a terminal on Android

3D Android mascot holding a terminal next to a smartphone displaying 'Termux' text.
Lucas Gouveia/How-To Geek

Termux is an incredibly powerful terminal emulator for Android. I previously showed you how to use it to download any media file, convert files, or ssh into another device. However, that barely scratched the surface. Here are even more awesome things you can do with a terminal window on your phone.

Use an AI chatbot

With Termux , you can run an AI chatbot in the command-line interface. You can keep it offline and run it locally on the device. Or, you can use API keys to access online AI chat models within Termux.

To run an AI chat locally, all you have to do is install Ollama and pick a suitable AI model that can run on your phone's hardware. You can install Ollama like this:

Ollama allows us to download and run AI models locally within the Terminal. Now let's start Ollama and download an AI model.

Swipe left to right to open the Termux sidebar. We'll open a new session here to download and run the AI model. I'm downloading the Llama 3.2 model with 1B parameters. It's about 1GB in size. However, you can choose the AI model you prefer.

Wait for the download to complete. It'll drop you into an AI prompt window when it's done.

Llama 3.2 running offline on my Android device.

You can access online models using API keys. There are tools like Termai that make this stupid simple. Just install Termai, provide the API key for Gemini or OpenAI. You can access it by typing "ai" followed by your prompt. You can also use the AI to write scripts for you, or you can pipe through the output of logs and files.

Accessing Gemini from the terminal.

Run an AI agent

For help with scripting, automation, or coding problems, you can even run an agentic AI like Gemini CLI within Termux. Gemini CLI can create and manage entire projects, automatically generate and debug code, write scripts, and interact with files. You'll need Node.js to install the Termux version of Gemini CLI available in the npm repos.

You can log into your Google account with the URL Gemini CLI provides, or you can enable Termux API to launch the authentication process in a browser window automatically.

Gemini CLI running on Android.

Once that's done, it'll drop you into the Gemini CLI prompt window. You can now use it just like you would on a desktop. I asked it to write me a script that displays weather forecasts within the terminal. It can do more useful stuff too, like generate web pages or scrape with scripts. I asked Gemini CLI to write a Python script that can find job leads on Twitter and Reddit. The script outputs the leads in a CSV sheet that's automatically saved in my phone's Downloads folder.

Host a personal website using your phone as the server

Termux can run in the background, and you can use its "wake lock" feature to make sure Android doesn't kill it to save battery. That means your phone can act as a reasonably reliable server. Plus, it's on most of the time. You could host and publish a blog without even touching a computer. Termux makes it simple enough.

Hosting a blog on my phone.
Advertisement
Advertisement

The centerpiece will be a bash script called Bashblog , which acts as the "content management system." The script allows you to set up a blog and publish posts without leaving the terminal. You can write the posts with the "micro" editor or something similar. Bashblog will save each post in a separate HTML file and update the index.html page whenever you "rebuild" the blog.

Using Micro to write a blog post in Termux.

Python can serve these HTML files using the built-in web server. That'll make your blog available over a local connection. You can use Cloudflared to connect this local server to the internet. By default, it assigns a random URL to the blog, but if you own a domain name, you can point Cloudflared to that domain address instead.

Demo site made in Bashblog

Bashblog

Bootstrap a Linux distro inside Termux

You can run entire Linux distributions inside Termux, too. There's a way to even get a GUI desktop environment running within Termux, but that gets a little complicated. Getting to the shell and accessing other package managers is pretty straightforward, however.

We'll need a tool called 'proot' for this job. You can install it using the 'pkg' command.

Once it's installed, you can get a list of available distributions.

I picked Arch Linux from the list and installed it.

It's about 150MB in size. Once it's installed, you can log into the distro.

You now have a full Linux operating system inside Termux, complete with the Pacman package manager.

Generating a list of available distros in PRoot.

Your phone can do so much more than just run the mainstream apps and games. Termux is the perfect way to make use of that power.

Advertisement
Advertisement
Mobilize your Website
View Site in Mobile | Classic
Share by: