The Linux terminal comes to Android with the help of a simple, easy-to-use app called Termux. Here's how to install and use Termux to give your Android a taste of Linux.
If you're like me, you always feel better being able to carry a Linux terminal around with you. With a Ubuntu phone, that's as simple as installing the official Terminal app and making use of the native Bash. However, with Android it's not always that simple.
Or is it?
Let me introduce you to a free, handy little app called Termux. This powerful Linux terminal emulator includes a lot of installable tools, including ack-grep, bzip2, cmake, dnsutils, emacs, gcc, git, gnupg, htop, less, nano, php, ssh, tar, and so much more. Once installed, these tools are fully functional and ready to be used...just as you would on a full-blown Linux machine. You can remote into your servers, write and compile code, and more.
More about Mobility
Already excited? You should be. Let's install Termux.
SEE: Securing Your Mobile Enterprise (ZDNet/TechRepublic special feature)
- Open the Google Play Store on your Android device.
- Search for termux.
- Locate and tap the entry by Fredrik Fornwall.
- Tap Install.
- Read the permissions listing (if applicable).
- Tap Accept.
- Allow the installation to complete.
Once installed, you should see a Termux launcher on your home screen and/or in your App Drawer. Tap the icon to fire up the application.
When you run Termux, you'll see a very simple screen with a basic Bash prompt (Figure A).
Termux running on a Nextbit Robin.
The first thing you'll want to do is update the package listing. To do that, issue the command apt update. Running this command may produce a message that you have upgradeable apps (Figure B).
A Verizon-branded Nexus 6 showing two upgradable apps for Termux.
If you do have upgradable apps, run the command apt upgrade and then, when prompted, tap yand hit Enter. All upgrades will run to completion.
Installing an app
To see the full list of available apps to install, issue the command apt list. You can then scroll through the results (Figure C) to find out if the app you want is available.
A complete listing of available Termux apps.
Let's say you want to install the openssh package: To do this, issue the command apt install openssh. You'll be prompted to hit y to approve the installation—openssh will install. With that app installed, you can issue the ssh command exactly as you would if you were seated before a standard Linux desktop or server.
You might install apps (such as the nano editor) that require usage of the Ctrl key; clearly, there is no such key on the Android keyboard, so what do you do? Fortunately, the developer took that into consideration. When you need to make use of the Ctrl key, simply press the Volume Down button. For example, if you have to save and close in nano, press and hold the Volume Down button and tap the x key.
Exiting the app
To exit Termux, you only have to type the exit command, hit Enter, and hit Enter a second time. The app will close, and you're back to Android.
What more could you want?
Termux is limited to command-line only tools, but when you need the power of the Linux terminal in the palm of your hands, you couldn't ask for a better solution than Termux. Give this app a try, and see if it doesn't make the Android platform feel a bit more complete.