DEV Community

Cover image for Getting Started with TERMUX πŸ“²
John Johnson Okah
John Johnson Okah

Posted on • Edited on

Getting Started with TERMUX πŸ“²

Have you ever been stuck with just your phone on a bus or in a boring environment and all you could think of is getting right back to your Dev environment? πŸ§‘β€πŸ’»

If you've got an Android device, we've got good news. ‡
Termux essentially turns an Android device into a lightweight and portable development environment, enabling users to perform various tasks, such as coding, scripting, system administration, and network testing, directly on their smartphones or tablets.

The Introduction πŸ“–

Termux is an Android terminal emulator and Linux environment app that allows users to run a full-fledged Linux distribution on their Android devices. It provides a powerful command-line interface (CLI) that enables users to execute various Unix commands, run shell scripts, and access a wide range of Linux tools and utilities directly on their Android smartphones or tablets.

Termux provides a convenient and flexible environment for developers, system administrators, and enthusiasts who want to perform tasks such as programming, scripting, development, testing, and system management on their Android devices. It offers access to a package manager (pkg) that allows users to install various software packages, including programming languages, text editors, version control systems, networking tools, and more.

With Termux, users can perform tasks similar to what they would do on a traditional Linux distribution, making it a popular choice for those who need a Linux-like environment on their mobile devices. It's worth noting that while Termux provides a Linux-like environment, it operates within the confines of Android's security mechanisms, so it might not have access to certain system-level functions or require root permissions for some operations.

The Setup βš™οΈ

Setting up Termux on an Android device is a straightforward process. Here's a step-by-step guide to help you get started:

1. Download and Install Termux
from Play Store
β†’ Go to Google Play Store
β†’ And install the Termux app
OR
from F-Droid:
β†’ Go to F-Droid App Store.
β†’ Search for the Termux APK file and click Download
β†’ Open the APK file and install it on your device

2. Open Termux:
β†’ After the installation is complete, tap on the "Open" button to launch Termux.

3. Update and Upgrade Termux Packages:
β†’ Once Termux is open, update and upgrade the packages to ensure you have the latest versions.
Run this command :

pkg update
Enter fullscreen mode Exit fullscreen mode

to update the package lists and Run:

pkg upgrade
Enter fullscreen mode Exit fullscreen mode

to upgrade all the installed packages to their latest versions.

4. Grant Access to Storage
β†’ Finally, permit Termux to access files in your device's internal storage that includes directories like DCIM, Downloads, and Documents.
β†’ Run this command to grant access:

termux-setup-storage
Enter fullscreen mode Exit fullscreen mode

Accept the pop-up notification on your device requesting file access from Termux.

The Features πŸ› οΈ

Termux comes with a range of powerful features that allow users to leverage a full-fledged Linux environment on their Android devices. Some of its key features include:

1. Terminal Emulator: Termux provides a fully functional terminal emulator that enables users to run various Unix commands, execute shell scripts, and interact with the Linux command-line interface (CLI) directly on their Android devices. Commands such asΒ ls,Β cd,Β mv,Β cp,Β touchΒ are available in Termux.

2. Package Management: Termux includes a package manager (pkg) that allows users to install, update, and remove software packages from a vast repository of Linux tools and utilities. This makes it easy to extend the functionality of Termux with various programming languages, text editors, development tools, networking utilities, and more.

Install a package with this:

pkg install <package-name>
Enter fullscreen mode Exit fullscreen mode

where <package-name> can be ffmpeg, vim, git, ...

3. Programming and Development Environment: Termux provides a platform for developers to write, compile, and run code directly on their Android devices. Users can work on coding projects using languages like Python, Ruby, Node.js, and C/C++

Run this command to install Python:

pkg install python3
Enter fullscreen mode Exit fullscreen mode

Then you can install Python packages with pip:

pip install <package-name>
Enter fullscreen mode Exit fullscreen mode

where <package-name> can be pytest, yt-dlp, flask, ...

4. OpenSSH and OpenSSL: Termux includes OpenSSH and OpenSSL, which provide secure encrypted communications and cryptographic functions, respectively.

5. File Access: Users can access and manipulate files on their devices, making it easy to work with all kinds of files from the terminal. In Termux, files on your device storage are located at /data/data/com.termux/files/shared/storage/

6. Text Processing Tools: Termux offers a variety of text processing tools like grep, sed, awk, and regular expressions, which are valuable for text manipulation and analysis.

7. Scripting and Task Automation: Users can create and run shell scripts on their Android devices, enabling automation of repetitive tasks.

8. Customization: Users can customize their Termux environment with themes, fonts, and various configurations to suit their preferences and workflow.

The Conclusion πŸ“•

Overall, Termux stands as a reliable and user-friendly solution, allowing individuals to embrace the power of a Linux environment on their Android devices, making it an invaluable tool for learning, productivity, and creativity, all in the palm of their hands.


PS:
- The F-droid Termux app can't install updates from Play Store.
- Do not install suspicious packages and do not run random scripts from the internet on Termux.
- For more Info visit Termux ℹ️ Wiki, for Discussions visit Termux πŸ’¬ Reddit, and to Report Bugs visit Termux 🐞 Github.

Good luck and have fun exploring

Top comments (9)

Collapse
 
hbtjr1275 profile image
Janell Thornton

It's great and flexible so I have my distro on my android devices.

Collapse
 
jjokah profile image
John Johnson Okah

Oh yeah, it is.

Collapse
 
hideandseekstheorder profile image
hideandseeks-hub

nice

Collapse
 
procyon108 profile image
Joseph Gant (Joe) • Edited

Thank you for this. Ive been using linux for a long time on my PCs and servers but Android development is new for me. I'm working on Android 10. It's a Chinese release supporting a DAP, so Im extara lost.
Is Termux still confined to its own app space on Android 10 only when writing to the external card, or is the internal storage sandboxed as well?

Edit: typo

Collapse
 
jjokah profile image
John Johnson Okah

Termux isn't confined to its own app space.
The app-specific directory /data/data/com.termux/files/ has unrestricted read and write access.
Other storage (like ~/storage/shared/) can still be accessed β€” with some restrictions.

Collapse
 
with_out_sugar profile image
Info Comment hidden by post author - thread only accessible via permalink
Ramas Something

hello why in termux when using the command "bash mkdir black_city, here as an example" it shows that execute binary file, and in general, when trying to create anything, it shows that there is some kind of error with binary files

Collapse
 
dubai_president_742a971fc profile image
Dubai president

Click on this link to message privately on telegram so you can receive my gift
🎁🎁🎁🎁🎁🎁🎁🎁🎁🎁🎁🎁🎁🎁🎁🎁🎁🎁
t.me/Mr_thank_you_342
t.me/Mr_thank_you_342
t.me/Mr_thank_you_342

Collapse
 
with_out_sugar profile image
Info Comment hidden by post author - thread only accessible via permalink
Ramas Something

What is?

Collapse
 
with_out_sugar profile image
Info Comment hidden by post author - thread only accessible via permalink
Ramas Something

Tai niekas atsakymo neΕΎino?

Some comments may only be visible to logged-in visitors. Sign in to view all comments. Some comments have been hidden by the post's author - find out more