Termux

Termux

A. Moradi

https://www.makeuseof.com/tag/use-linux-command-line-android-termux/

Android is a very capable operating system, with more and more applications approaching desktop class. Yet sometimes, you still really need to work in order to accomplish something on Android that would be a snap on a desktop.

Fortunately, Android is Linux Is Android Really Open Source? And Does It Even Matter? Is Android Really Open Source? And Does It Even Matter? Here we explore whether or not Android is really open source. After all, it is based on Linux! Read More at its core. And Termux builds on this existing infrastructure. It provides a command line environment and allows you to install honest-to-goodness Linux apps on your Android device. Let’s go get some.

Download: Termux (Free)

Why Use Termux?

There are already some apps in the Play Store that are ports of Linux applications to Android. These differ from Termux in that they replicate those Linux apps, but they’re made in an “Android way.” In contrast, Termux is a self-contained Linux environment. Its programs are (for all intents and purposes) exactly the same as their Linux counterparts. This conveys some advantages over the ported applications:

  • Consistency — Linux apps that have been ported to Android have to receive a user interface of some kind. The user experience on Android depends a lot on how much effort the developer puts into it. It is bound to be different in any case. But Termux apps are the same as the Linux versions, from keyboard shortcuts to how you install them.
  • Compactness — The addition of the “Android code” described above can cause some slim applications to grow chunky. Take an Android SSH client (VX ConnectBot shown below) for instance, which can run anywhere from 2 MB to 12 MB in size. Yet with the exception of some a few graphical screens, you still end up in a terminal as shown in the below image. Compare this to dropbear, available in Termux, which weighs in at 396 KB (that’s kilobytes) installed. And it provides an SSH server to boot.


Using Termux

Before diving into usage, let’s put something right out there. Termux is first and foremost a command line environment. There’s no fancy user interface with shiny buttons to be found here.

This goes not only for the base Termux package, but its apps as well. You won’t be getting the newest version of LibreOffice. You also need to be comfortable with the command line in order to install and use these programs. If you’re new to it, we have some great resources to help you. You can read up on the essential commands An A-Z of Linux - 40 Essential Commands You Should Know An A-Z of Linux - 40 Essential Commands You Should Know Linux is the oft-ignored third wheel to Windows and Mac. Yes, over the past decade, the open source operating system has gained a lot of traction, but it’s still a far cry from being considered... Read More , the 40+ most used terminal commands 40+ Most Used Linux Terminal Commands 40+ Most Used Linux Terminal Commands Whether you're just getting started or simply curious about the Linux terminal, here are the most common commands that will carry you through your entire time on Linux. Read More , how to teach yourself terminal commands 4 Ways to Teach Yourself Terminal Commands in Linux 4 Ways to Teach Yourself Terminal Commands in Linux If you want to become a true Linux master, having some terminal knowledge is a good idea. Here methods you can use to start teaching yourself. Read More , and websites and books that can educate you further Top Websites and Books to Transform You into a Linux Command Line Hero Top Websites and Books to Transform You into a Linux Command Line Hero The Linux command line is an extremely powerful tool -- but it can also be intimidating. Use these websites and books to get a handle on it. Read More .

That said, the process to install programs is straightforward. Termux uses the same package installers available in Debian and Ubuntu Linux, called Advanced Packaging Tools (APT). To see what applications are available, open Termux and type the following at the prompt:

apt list


This displays a list of all packages, or software bundles, you can install. If you’d like some details on one, just type this and include its name:

apt show [app name]


It will display a short summary of the package, as shown above for the Emacs text editor. Finally, to install, just use this:

apt install [app name]


Check out our guide on using APT A Beginner's Guide to Installing Software in Ubuntu with APT A Beginner's Guide to Installing Software in Ubuntu with APT If you've used Ubuntu you have probably used the apt command at some point. But did you know there's so much more to it than apt-get install and apt-get upgrade? Read More for more detail, like how to upgrade packages. Once the install is finished, you can start the program by typing its name at the prompt. The screenshot below shows the nano text editor running after the above install.


Now let’s take a look at some of the awesome utilities you can get through Termux.

Core Linux Utilities

Once you install Termux, you can do some nifty things straight out of the box. The base app will allow you to use basic Linux utilities How to Manage Files in the Linux Terminal and Desktop How to Manage Files in the Linux Terminal and Desktop Once you make the change to Linux, you'll find a sensible desktop that is easy to use, from installing new apps and launching them to organizing your data. Read Moreto perform activities such as copying (with the cp command) and moving (mv) files, reading directory contents (ls), and deleting things (rm).

Nothing you can’t do with an Android file manager, right? Well, Termux also includes the “link” command (ln). This is useful immediately — by default, Termux has you working in the directory /data/data/com.termux/files/home, which is not where the rest of your files are (usually /sdcard). But you can create a new symbolic link in this directory (e.g. /data/data/com.termux/files/home/documentsto /sdcard/Documents).

This will allow you to quickly navigate to those files.


Replaces: The file management commands in the base Termux install can reduce the need for separate file managers The 7 Best Free File Explorers for Android The 7 Best Free File Explorers for AndroidThere are a bunch of file management and file exploring apps out there for Android, but these are the best. Read More unless they have additional features. The ability to create links between directories can also eliminate dedicated apps such as Link Folder [No Longer Available], and it saves you from rooting your phone to get this functionality.

Text Editors

Termux provides recent versions of both of the “main” Linux text editors: VIM The Top 7 Reasons To Give The Vim Text Editor A Chance The Top 7 Reasons To Give The Vim Text Editor A Chance For years, I've tried one text editor after another. You name it, I tried it. I used each and every one of these editors for over two months as my primary day-to-day editor. Somehow, I... Read More (v8.0, the latest stable at the time of writing) and Emacs (v25.2, also current). The below images show Emacs running in the konsole terminal in Linux (top) and Termux (bottom). Note the similarities.

Other editors such as the minimalist nano are also available.



Now, Android has a lot of text editors. Like, a lot. And many of them do a very good job at saving and opening text files. But many do little more than that, as though they were the creator’s “test app” for Android.

Emacs and VIM are highly capable text editors. Like to work in Markdown Learning Markdown: Write For The Web, Faster Learning Markdown: Write For The Web, Faster Markdown is the best way to write in plain text but still create complex documents. Unlike HTML or LaTex, for example, Markdown is simple to learn. Read More ? Both support it quite well. Into the whole “distraction-free” mindset Write In Peace With These Distraction-Free Editors Write In Peace With These Distraction-Free Editors I have felt it. Visual clutter – thanks to menus and other markup features – have often cemented my writer’s block. So, I have tried out quite a few distraction-free text editors in a grand... Read More ? It doesn’t get much more distraction free than VIM. Need something to take notes and provide to-dos? Org-mode in Emacs has you covered. You can even use Emacs as your file managerscreenwriting appTrello clientmusic player, or to play Minesweeper.

Replaces: Android text editors 7 Distraction-Free Text Editors for Android Compared: Which Is Best? 7 Distraction-Free Text Editors for Android Compared: Which Is Best? Get some real work done on your Android device by using one of these amazing text editors. Read More tend to have one major feature — one may focus on distraction-free drafting, another can preview Markdown Write & Preview Markdown In Style With LightPaper [Android] Write & Preview Markdown In Style With LightPaper [Android] A text editor should not get in your face. The more you notice it, the worse it is. The best ones are nearly invisible, staying out of the way and letting you become one with... Read More or other formatting, and a third keeps notes Draft: A High-Quality, No-Nonsense Way To Keep Notes On Android, With Full Dropbox Sync Draft: A High-Quality, No-Nonsense Way To Keep Notes On Android, With Full Dropbox Sync I consider myself a discerning note-taker. If a note-taking application isn't just so, it can drive me crazy. This is where I'm supposed to tell you I'm on a never-ending quest to find a great... Read More (though it’s really just a text editor). The terminal-based editors above can fulfill these needs in a single program, with the added bonus of being available on desktop platforms as well.

Command Line Utilities

Termux packages include a number of useful Linux command line utilities:

Replaces: Dedicated standalone programs, depending on how many of the above functions you need. Even if there are apps that handle all archive and graphics formats, you’d have five new apps cluttering up your drawer. It’ll be even more if you need separate apps for separate formats.

Servers

We’ve already shown how you can turn your Android device into a web server How to Turn an Android Device Into a Web Server How to Turn an Android Device Into a Web Server Want to host a simple website without an expensive hosting plan? Here's how to host a website on your Android phone or tablet. Read More with specific apps. Termux similarly provides honest-to-goodness Linux web servers like Apache How To Set Up An Apache Web Server In 3 Easy Steps How To Set Up An Apache Web Server In 3 Easy Steps Whatever the reason is, you may at some point want to get a web server going. Whether you want to give yourself remote access to certain pages or services, you want to get a community... Read More , nginx, and lighttpd The Best Linux Web Server Software (& Apache Alternatives) The Best Linux Web Server Software (& Apache Alternatives) Read More .

Why would you want to run a web server on your Android device? In addition to programming, bear in mind that many of today’s best applications are web apps. If, for example, you’re looking for a true project management application to run locally on your device, the native Android options are pretty bleak. But you could install nginx, the PostgreSQL database, and Python, and use Taiga. All without having to sign up for any third-party services or hosting.

Termux also includes dropbear, which (as mentioned) provides an SSH server to log into your phone/tablet and transfer files in addition to a client. This is useful in situations where you want to exchange a few files with another machine and 1) don’t want to use cloud services, and 2) won’t or can’t install the drivers to plug into the device directly. You can start up the dropbear server for a moment, use a client on Windows 4 Easy Ways to Use SSH In Windows 4 Easy Ways to Use SSH In Windows SSH is the de facto solution for securely accessing remote terminals on Linux and other UNIX-like systems. If you have a remote SSH server you want to access, you'll have to download an SSH client.... Read More or macOS 5 Fun & Useful Terminal Commands You Can Use More Than Once [Mac & Linux] 5 Fun & Useful Terminal Commands You Can Use More Than Once [Mac & Linux] There is a ton of information on the Internet about various Terminal commands and ways to customise your Mac or Linux machine with the Terminal. Here are some commands which are really useful and can... Read More , grab what you need over the network, and shut it down.


Replaces: Apps like the free PAW Server [No Longer Available] or the paid Ulti Server allow you to spin up a web server. And even though I’m a fan of SSHDroid (shown above), the prospect of having a lightweight server I can start from the command line is still intriguing.

Development

While many Android apps (e.g. “code editors”) provide the ability to write code, they may not provide the languages themselves. With Termux you can test that code right on your device. It offers standard distributions of programming languages such as:


Source control systems git and Subversion are also available, which have their uses beyond just development. If you like being in control of your own data, source control let’s you stash your files wherever you want. You also control when you send updates to other devices, and you can use “tags” to label versions (raise your hand if you’ve ever named a file “mydocument_v12_Aaron’s_edit_final_for_real_the_last_one.DOCX”).

Replaces: There are some programming language packages for Android, such as PHPQPython, or Pocket Ruby [No Longer Available]. But these provide their own bulky UIs, and may require yet other apps to be fully useful (like the Apache-based server to go along with PHP). There are Android based applications for both git, such as the highly-rated Pocket Git, and svn, such as Open Android SVN Pro [No Longer Available]. However neither is free, and you need to have a separate app for each source control type. Termux provides both in the same package for free. By going with source control you can also cut down on clients for cloud syncing services such as Dropbox.

Add a Little Linux to Your Android

Termux is a super-compact application that opens up a lot of functionality for your Android device. The command line is one of the most powerful features of Linux, and Termux builds on your device’s Linux kernel to make you more efficient on the go. And who knows, maybe dabbling with these applications will convince you to take the plunge on the desktop as well.

Do you know all the essential Linux commands? Check out our Linux commands cheat sheet The Linux Commands Reference Cheat Sheet The Linux Commands Reference Cheat Sheet This simple cheat sheet will help you get comfortable with the Linux command line terminal in no time. Read More to find out!

Image Credit: ST22Studio via Shutterstock.com

Explore more about: AndroidLinuxTerminal.


Report Page