How to Use Linux Terminal on Android


Android is an indivisible part of the Linux family, no matter what Google says. Android is based on Linux Kernel, and users can access the Terminal just like on any other Linux OS. If you are a long-time Linux user, you are well aware of the power of Linux Terminal. Also, if you are an Android user, what if I tell you that you can feel the same power on your device.
You can do programming (using vim or nano), compiling, and then run the program all in the Terminal itself. You can learn the basics of Linux terminalterminal commands, install command-line programs, and there is plenty of cool stuff you can do. All you have to do is follow this simple guide to set up the Linux Terminal on your Android device.

Install Terminal on Android

Google playstore showing the list of terminlas
You can download a Terminal application from Play Store (yes, as simple as that). However, there are several Terminal emulators to choose from, and you can go with anyone you like. What I recommend you is to go with Termux (personally tried and tested). Termux works perfectly without root access, supports the apt package manager to install the application packages and it’s very lite (less than a half megabyte).

installing termux (terminal) on android

  • Setting up the Terminal

    Now, you have installed a Terminal emulator on your Android device. It’s time to set it up so that you can start using it just like a regular Linux Terminal. Yeah, you can do just fine without setting it up, but I recommend you do that first. 
    • Use command termux-setup-storage if it doesn’t ask for storage permission itself
    • Run pkg update && upgrade and hit y to confirm
    • Run pkg install apt to install the apt package manager
Setting up the termux terminal on android
Now you can start installing the applications via the apt install command. To view the list of available application packages, use the apt list command.

Practical Use Cases of Terminal on Android



For programming

JavaScript programming on Vim (via termux)
You can pretty much do all the programming on your smartphone via Terminal. Only if you know how to use vim or nano (or any other command-line editor) as a code editor. Install python3 and pip3 to run python3 scripts, clang, or GCC to run C, C++ programs, nodejs for javascript, and more. You can also attach your keyboard via OTG, and there you are programming on the go.

Install a full Linux distribution

Hard to believe, but yes, you can install a full-fledged Linux desktop on your android device via Terminal. There are plenty of guides available that can guide you through the procedure with or without a terminal. Although the limitations are there but, no one can stop a Linux enthusiast from installing Linux on their smartphones too.

As a portable webserver

If you are a web developer like me, you can understand what I am talking about here. You always have to create an HTTP server to show the work to your colleagues or your client. Now you can do that too on your Android device:
  1. By using the command inside your project folder python3 -m http.server 3000(make sure to install python3 first by apt install python3).
  2. And then, in the second Terminal window type ssh -R 80:localhost:3000 serveo.net (make sure to install ssh by apt install openssh-server)to make the local server publicly available.

Conclusion

You have to have a terminal to take full control of your device. Having a terminal on an android device might feel gimmicky to even regular Linux users. However, the heart wants what it wants. I use it to create JavaScript functions on the go (when I get the idea to solve a particular problem I was having). All I can say is at least give it a try and find out if it can do anything for you or your work-flow. Also, let us know if you find it any helpful at all by commenting in the comment section down below.

Comments