Use a Linux terminal on your Android phone

Use a text editor, SSH into a computer, or even maintain your Kubernetes cluster right from the palm of your hand with Termux.
182 readers like this.
tux and android stuffed animals on shelf

Quinn Dombrowski via Flickr. CC BY-SA 2.0

When it comes to ultra-mobile computing, I prefer the PocketCHIP or a Raspberry Pi with a screen rather than a mobile phone or tablet. These solutions offer a pure Linux environment that's as open source as the hardware allows and make no assumptions about how I expect to work.

Sometimes, though, the only thing I have on me is a mobile phone. While there are some really great Android apps out there, many feel like overkill for simple tasks, especially knowing how much can be done in a simple terminal on my Linux desktop. I'm not the only person who feels this way, and that's why the Termux project was born.

Termux is a terminal emulator and Linux environment app for Android. It also doesn't require you to root your device.

Termux installs a minimal base system automatically, and additional packages are available using a package manager, just as you do with Fedora, Debian, or the like.

Install Termux

Installing Termux is as easy as installing any app on your Android device. You can use either the default Google Play store or the open source app repository F-Droid.

You can also download the source code and compile it yourself.

Linux-like Android

Once you have Termux installed on your mobile phone, you essentially have a minimal Linux system running as an application on your (Linux-based) Android device. You can use most of the usual terminal applications you are familiar with, or you can become familiar with them now that you have them on your phone. Most importantly, the Termux interface provides software Ctrl, Alt, Esc, and arrow keys, so essential keystroke shortcuts are easy to type—even on a virtual keyboard. On long trips, I prefer to carry a Bluetooth keyboard with me, so I can use Termux as easily as a terminal on my desktop or laptop.

By default, Termux runs Bash:

$ echo $0

Most of the commands you're used to will work as expected, whether they're built-in Bash commands or the usual array of common Linux commands and utils. There are also several other shells available, including Zsh and tcsh.

Installing commands

If you're used to Linux, or even Homebrew on a Mac or Chocolatey on Windows, then you already know how to install more commands for Termux. Its backend package manager is Apt from Debian Linux, but Termux uses the pkg command as a simplified frontend interface. The result approximates the consistent simplicity of Fedora's DNF experience, and I'd love to see pkg as an abstraction layer on more platforms (imagine using the same package management commands on Debian, RHEL, and Slackware).

The first package I installed was a simple text editor:

$ pkg search jed
jed/stable 4.6-4 aarch64
Lightweight text editor
$ pkg install jed

Running Jed was exactly the same as running it on my RHEL desktop. Both run in the terminal and use the same keyboard shortcuts. That's exactly the mobile experience I want: the same as my desktop.

Remote control

A text editor is one thing, but Termux reveals its true potential the first time you SSH into a computer. Through this simple terminal, you can log onto any computer on any network you have access to. You have a portable console you can use either as a host or as a terminal into any amount of computing power available to you.

This doesn't end with SSH, though. There's a Termux package for kubectl, so by using the use-context option in kubectl, you can maintain your Kubernetes cluster from anywhere.

Contributing to Termux

One of my favorite things about Termux is that it removes a significant barrier to contributing to a mobile project. All current open source mobile platforms are Android or Android-based, requiring a special toolchain and a fair amount of Java knowledge.

Termux, by nature, shields a potential new contributor from much of that because you can write packages for Termux without knowing anything about Android. You can create a package definition for Termux as long as you know how to write a shell script because you're writing a package for the Termux subsystem.

Put a terminal in your pocket

Termux is a great way to learn the Linux terminal, and it's easy to install. Put Termux on your phone or tablet, check out some of our terminal basics (such as our articles about mastering the ls and cat commands) and our Bash cheat sheet, and transform the way you use your mobile.

What to read next
Seth Kenlon
Seth Kenlon is a UNIX geek, free culture advocate, independent multimedia artist, and D&D nerd. He has worked in the film and computing industry, often at the same time.


Been using it for over a year now. Combined with screen* and a bluetooth keyboard it make for a very powerful and highly useful combination.

* or other similar tools.

Installed Termux a couple of years ago - but my phone screen was just too small to make it useful, so there was no real "use case".

However! It is DeX aware - and - I just updated from a Nokia to Samsung handset with USB C and DeX - and I'm running TermUX on a 27" 1080P monitor and it's brilliant... need tmux? "pkg install tmux"... Didn't need to install mosh client however - it's there, got my .ssh/ all setup.

I can mosh to my RPi over LAN, internet, or the OpenVPN server running on the same Pi...

With any of my customer's VPN clients connected from my phone (e.g. Pulse, CheckPoint) I can SSH from termux straight to a Linux jump server in their environment (and as well as that - I can Citrix or RDP from DeX).

Got a NextDock 2 due for delivery in September, and this feature will be the "killer app" for my purposes.

One thing that is a tad annoying in termux - is mouse and clipboardd support which seems rudimentary at best... but still a great app...


Unable to locate package jed after doing search command

Keyboard choice is pretty important. If an external keyboard is not available, CodeBoard is a good choice.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.