ExplainerLinuxTech/WebTutorials/DIY

Termux Guide for Beginners and Advanced Users

Introduction

Termux

is a powerful terminal emulator and Linux environment app designed for Android devices. It provides a full-fledged Linux environment without requiring root access. This versatility makes Termux a go-to choice for developers, students, and tech enthusiasts who want to perform coding, networking, and automation tasks on the go.

In this guide, you’ll learn:

  • What Termux is and its core functionalities
  • Step-by-Step installation process
  • Key commands for package management and system utilities
  • Development environment setup for languages like Python, Node.js, C, and PHP
  • Advanced Termux addons for improved productivity

What is Termux?

Termux is an Android terminal emulator that brings a powerful Linux environment to mobile devices. With no additional setup or rooting required, users can:

  • Run Linux commands efficiently.
  • Manage files and directories like a typical Linux system.
  • Code and develop directly on their Android device.
  • Connect to remote servers securely with SSH.

Key Features of Termux

  • Flexible Environment: Supports Bash, Zsh, Vim, and Nano.
  • Secure Access: Enables SSH connections via OpenSSH or Dropbear.
  • Package Management: Uses pkg and apt for installing and managing packages.
  • Portable Development: Supports C, Python, Node.js, Go, PHP, and more.
  • Add-on Support: Expand functionality with Termux add-ons like Termux:API, Termux:Boot, and Termux:Task.

Step 1: Installing Termux

Recommended Installation via F-Droid

Since Termux is no longer maintained on Google Play Store, follow these steps to install it from F-Droid:

  1. Download the F-Droid APK from https://f-droid.org/.
  2. Install F-Droid by enabling “Install Unknown Apps” in your Android settings.
  3. Open F-Droid and search for Termux.
  4. Install Termux and launch it.

Post Installation Setup

Once Termux is installed, update your system with:

pkg update && pkg upgrade

Step 2: Essential Termux Commands

Package Management Commands

  • Install a package:
pkg install <package_name>
  • Search for a package:
pkg search <keyword>
  • Upgrade all packages:
pkg upgrade
  • Uninstall a package:
pkg uninstall <package_name>

System Utility Commands

  • Check IP address: ifconfig
  • Clear terminal screen: clear
  • Exit Termux: exit

Step 3: Installing Popular Programming Languages in Termux

Install Python

pkg install python
  • To verify installation:
python --version

Install Node.js

pkg install nodejs
  • To verify installation:
node --version

Install C Language Compiler (Clang)

pkg install clang

Install PHP

pkg install php

Install Go Programming Language

apt install golang

Step 4: Setting Up Essential Tools

1. Install Git for Version Control

apt install git
  • Clone a repository:
git clone <repository_url>

2. Install Nano Text Editor

pkg install nano

3. Install Apache2 for Web Hosting

apt install apache2

To start the Apache server:

apachectl

To test the server:

Open your browser and type localhost:8080/read.txt after moving the file to the correct Apache directory:

mv read.txt /data/data/com.termux/files/usr/share/apache2/default-site/htdocs/

4. Install Node-RED for Automation

apt update
apt upgrade
apt install coreutils nano nodejs
npm i -g --unsafe-perm node-red
node-red

Access Node-RED through your browser at localhost:1880.

5. Install Mosquitto MQTT Broker

pkg install mosquitto

To run the broker:

mosquitto

Step 5: Using SSH in Termux

SSH is essential for secure remote access.

Install SSH Packages

pkg install dropbear
pkg install openssh

To find your IP address for SSH use:

ifconfig

To connect via SSH:

ssh user@remote_ip

Step 6: Advanced Termux Add-ons

Termux:API

  • Provides Android hardware features (e.g., SMS, battery status, camera, etc.).
pkg install termux-api

Termux:Boot

  • Enables Termux scripts to run automatically when your device boots.
pkg install termux-boot

Termux:Widget

  • Allows Termux scripts to run directly from your Android home screen.

Step 7: Best Practices and Security Tips

  • Regularly update Termux using:
pkg update && pkg upgrade
  • Be cautious when running untrusted commands.
  • Back up essential data and Termux projects to avoid data loss.

Conclusion

Termux is a robust and versatile platform for mobile computing, ideal for developers, sysadmins, and enthusiasts alike. Whether you’re coding on the go, testing network protocols, or controlling remote servers, Termux provides a powerful Linux environment right in your pocket.

If you have questions or want to explore additional Termux capabilities, feel free to ask.


You may like also:

Harshvardhan Mishra

Hi, I'm Harshvardhan Mishra. Tech enthusiast and IT professional with a B.Tech in IT, PG Diploma in IoT from CDAC, and 6 years of industry experience. Founder of HVM Smart Solutions, blending technology for real-world solutions. As a passionate technical author, I simplify complex concepts for diverse audiences. Let's connect and explore the tech world together! If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning! Linkedin

5 thoughts on “Termux Guide for Beginners and Advanced Users

Leave a Reply

Your email address will not be published. Required fields are marked *