How to Use Termux to Run Command Line Linux Apps in Android

The “Termux” Android app, which allows you to run command-line programs and scripts on Android devices, is covered in this article.

Termux is an open-source terminal emulator for Android phones and tablets. It also functions as a tiny Linux OS, with many of the tools and utilities found in desktop Linux variants. Through its own package manager, Termux allows you to install and execute a variety of command-line apps. To install and use Termux on Android, you don’t need root access. You can even utilize Termux (through VNC) to use lightweight desktop environment GUIs without hardware acceleration, however, they may be slow and unusable on small screen touch devices. Termux is a popular choice among Android developers and other users who want to use CLI Linux programs. It’s the closest thing Android has to a Linux OS, and it’s a joy to use because of its touch-optimized UI that’s perfect for small screens. Termux has extra keyboard actions that make it easier to type symbols, as well as auto-completion through the TAB> action key in the top row of the on-screen keyboard.

Use Cases

There are a few things you can do using Termux:

  • Run Python scripts
  • Run Bash scripts
  • Play command-line games
  • Access Vi editor
  • Make SSH connections
  • Create Python virtualenv
  • As long as you don’t require GUI access, you can develop apps.
  • Additional packages can be installed using package managers such as pip, npm, cpan, gem, tlmgr, and others.
  • Simply, anything that a command-line interface for an installed package allows you to perform.

Installing Termux on Android

Termux may be downloaded and installed from Google Play or F-Droid. When you run Termux using the launcher, you should see the following screen:

Enabling Storage Access on Termux

You must first set up the Termux storage and provide storage access permissions to Termux when prompted before you may access or save files via the Termux terminal. You can do so by typing the following command into your terminal:

termux-setup-storage

Once you’ve completed the storage setup, you’ll be able to find Termux files in the “shared” folder of your Android device’s internal storage. You can manually create the “shared” folder if it does not exist. “/storage/emulated/0/shared” is usually the complete path to this “shared” folder.

Installing and Managing Official Termux Packages

To update and upgrade repositories after installing Termux, execute the command below:

pkg upgrade

You may now use the following command to install the packages you want:

pkg install <package_name>

After installation, you’ll be able to use the Termux terminal to run the command for the installed package (just like you would on a desktop Linux OS):

A list of installable Termux packages can be found here. You may also use Termux to search for and find packages. To do so, type the following command in the command prompt:

pkg search <search_term>

You may also use the following command to get a list of all packages:

pkg list-all

Installing Deb Packages in Termux

Certain “.deb” packages from Ubuntu or Debian repositories can be installed as long as they are designed for your mobile’s architecture (these days, mobiles mostly have aarch64 and aarch32 architectures). It’s worth noting that some packages may refuse to run under Termux. Run the command in the following syntax to install a “.deb” package:

dpkg -i <deb_package_name>

In Termux, run the following command to uninstall a manually installed “.deb” package:

dpkg –remove <deb_package_name>

Run the following command to see a list of all manually installed “.deb” packages:

dpkg -l

Any “.deb” package from any package provider can be installed as long as it fits the conditions for compatibility. To avoid the installation of questionable packages, you should always be cautious while picking up third-party packages.

Enabling Additional Repositories in Termux

Extra repositories can also be enabled in Termux to allow for the installation of additional packages. More repositories can be found by visiting this page and clicking on repositories with names that finish in “-packages.” The command to enable these repositories can be found in their “README” files. The command to enable additional repositories is as follows:

Here are some examples that I tested and found to work with Termux:

$ pkg install x11-repo

$ pkg install game-repo

$ pkg install root-repo

$ pkg install unstable-repo

$ pkg install science-repo

It’s also possible to activate several third-party community repositories. Here will take you to a list of these repositories.

Installing Termux Add-ons

Termux offers a number of handy add-ons that can be downloaded from the Play Store and installed on an Android device. Some of these supplementary features are free, while others require a fee. A list of available add-ons may be found here.

Conclusion

On Android, you can install and run entire Linux environments with some apps from the Play Store. However, some of them require root access and are not particularly user-friendly. There is nothing on the Play Store that compares to Termux in terms of user-friendliness.

Loading Facebook Comments ...