>_cat termux.md|Linux System
Index

Termux Cheatsheet

SPEC: MDX·/termux·Kernel, systemd, disk partitioning, LVM, and OS maintenance.

Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required.

Installation

Download the latest APK from F-Droid or GitHub. Do not use the Google Play Store version, as it is outdated and no longer maintained.

Package Management (pkg)

Termux uses pkg which is a wrapper around apt.

pkg update                  # Update package list
pkg upgrade                 # Upgrade installed packages
pkg install <package>       # Install a package
pkg search <package>        # Search for a package
pkg uninstall <package>     # Remove a package
pkg list-all                # List all available packages

Storage Access

By default, Termux cannot access your phone's internal storage (Downloads, DCIM, etc.). You must request permission and set up storage links.

termux-setup-storage

This will create a ~/storage directory with symlinks to your phone's shared storage.

Useful Termux Add-ons

Termux has several add-on apps (install from F-Droid):

  • Termux:API: Access Android hardware APIs (Camera, GPS, SMS) from the command line. (Requires installing pkg install termux-api).
  • Termux:Styling: Customize fonts and color schemes.
  • Termux:Widget: Run Termux scripts from your home screen.

Basic API Examples (Requires Termux:API)

termux-battery-status       # Get battery info
termux-clipboard-get        # Read from Android clipboard
termux-clipboard-set "Hi"   # Write to Android clipboard
termux-toast "Done!"        # Show an Android toast notification
termux-torch on             # Turn on flashlight

Running an SSH Server

You can access your Termux environment from your PC via SSH.

pkg install openssh
sshd                        # Start SSH server (runs on port 8022 by default)
whoami                      # Get your username (e.g., u0_a123)
passwd                      # Set a password

From your PC:

ssh u0_a123@<android-ip-address> -p 8022