Termux, the best linux terminal for Android

Marc Bilodeau/ March 18, 2017/ Coder's Life, Minimalism

I’m a huge proponent of digital minimalism. It’s one of my long term goals to have all my tech gear within a single device. Fortunately, I accomplished this feat reasonably well using a Samsung Galaxy S4, then the Google Nexus 6P, and now the Google Pixel XL. However, once I found Termux it took my Smartphone Computing to a whole new level.

It’s certainly been a lot of trial and error to achieve autonomy with a smartphone. There are a lot of great apps out there that I use daily. Although, the one tool I lacked was a decent terminal. I used apps like Juice SSH and Android Terminal Emulator to accomplish some tasks. Also, I wanted my favorite editor Emacs (sorry Vim people) and source control tools git and svn easily accessible from my Google Nexus 6P.

Thankfully, I have a solution. I use a virtual machine with all my development tools in which I access using VNC. Then, I would happily write code on that desktop using my smartphone. This works well since VNC Viewer and Microsoft Remote Desktop are available on the Google Play Store. Alas, I didn’t want to rely on different apps or a virtual machine to do my day-to-day work. Then, I found the app that took my Smartphone Computing to the next level.

Termux

Termux is an Android App that provides both a terminal and linux environment. Also, it works without rooting the device. Once it’s been downloaded and launched for the first time, a minimal base system is installed automatically. Then, one can use the package manager to extend the capabilities of the environment.

Termix Terminal running on my Google Nexus 6P with Android 7.1.1

Termux running on my Google Nexus 6P with Android 7.1.1

I highly recommend referencing the online documentation. It’s an easy read, short, and to the point. There you can find many ways to get help and follow the project.

After I first installed Termux, I wasn’t overly excited until I noticed that apt was available. So naturally, I executed apt list | more and that’s when I said Wow!

termux on android with a google nexus 6p

So many available packages

At the time of this writing, there are 596 packages ranging from utilities, language interpreters, editors, clients, libraries, servers, databases, and more. I studied the list carefully, and then installed the following packages:

  • ack-grep
  • apt
  • bash
  • binutils
  • clang
  • curl
  • dash
  • dpkg
  • emacs
  • gawk
  • git
  • grep
  • make
  • man
  • openssh
  • perl
  • rsync
  • sed
  • sqlite
  • subversion
  • termux-api
  • tmux
  • weechat
  • wget

Doing More with Less

Once I played around with some commands and became familiar with this new found treasure, I looked through my installed Android Apps to see what I could uninstall.

  • Juice SSH – Termux has an ssh client with the openssh package. Although, I like how I can organize my connections with Juice SSH. Regardless, it’s not enough for me to keep a second ssh client.
  • BusyBox with Android Terminal Emulator – These two apps together are similar to Termux. However, Termux feels more like a linux terminal to me. Also, it’s one app instead of two.
  • IRC for Android – This is an excellent IRC client that I really like. However, Termux has the weechat package. Although it’s not as graphical as IRC for Android, it works great for all my IRC needs.
  • Advanced REST API Client – I use many different RESTful API. Termux provides packages like wget, curl, and perl. Now, I can utilize existing scripts that I’ve previously written.

In short, these apps are excellent. However, they are no longer needed since Termux allows me to do the same tasks without having to switch to another app.

Multi-tasking

A major disadvantage to smartphone computing has been that only one app could be in focus at a time. Then, Android 7.0 introduced multi-window support. This allows two apps side by side. Unfortunately, the app has to support this functionality. Many developers have already taken the time to add multi-window support. Still, it can be cumbersome to switch between apps.

Termux streamlines workflow with the ability to open multiple sessions. Also, each session can be named to keep workspaces organized.

Termux with multiple sessions

Create multiple sessions and rename them accordingly

However, I want multiple windows within a single session. No worries! Termux delivers with the package Tmux. With a few key bindings, multiple windows come alive in a single session. For example, here is my typical screen with Emacs, weechat, and an ssh connection to my build server.

Termux makes developing from Android phones possible

What most of my day looks like when I write code

Still, there is one convenience missing. How do I access my saved documents and downloaded files?

Main Storage

After playing around a bit, I quickly realized I wanted easy access to the Main Storage (/storage/emulated/0) from a session. Thankfully Termux makes this possible, and the process is quite simple. It isn’t enabled by default since the user first must give permission to Termux.

First, run apt update && apt upgrade to make sure all packages are the latest and greatest. Then, execute termux-setup-storage from any session. This creates a folder called storage/ in the $HOME directory. Several symbolics links are also available to easily access different areas of storage. An excellent explanation about Internal and External Storage with Termux can be found here.

Termux accessing Main Storage

The storage directory with symbolic links

Now, it’s easy to add, update, and delete files from a session without having to use a file manager app. With all the different packages and features, Termux is extremely flexible.

Conclusion

Up until Termux, I was having a hard time finding a Terminal that was flexible enough to perform many administrative and development tasks with ease. Termux not only meets those expectations, it exceeds them.

Installation is easy and customization takes no time at all. In the time that I’ve been using Termux, I’ve been more productive and able to uninstall some redundant apps. For those like me who use a Smartphones as their PC, Termux is a must have.