Termux Field Guide
Android / Linux / Termux / ADB / Shizuku / Root

Termux Field Guide

Your phone already runs a Linux kernel and carries more compute than the servers that powered the early web. This manual shows how to turn a stock Android phone into a pocket workstation — shell, SSH, Git, code, web servers, automation — and exactly where the line sits between what needs no root at all, what needs ADB or Shizuku, and the few jobs that genuinely justify unlocking the bootloader.

Stock ADB Shizuku Root Verified 2026-08-29 Single-file / Offline
How to use this guide: this file works fully offline — save it to your phone, print it, or serve it locally with python -m http.server. Every command block has a copy button. Placeholders such as USER, SERVER, and PACKAGE.NAME must be replaced with your own values before running anything.

00 — Start here

The most important rule in this guide is simple: do not root a phone just because you want Linux tools. Termux already gives you a strong Linux-like userspace without root. Add PRoot for a conventional Debian/Ubuntu-style environment, ADB or Shizuku for selected Android-level operations, and SSH for real server administration. Root is the final layer, not the starting layer.

Best default path

  1. Install stable Termux from F-Droid or the official GitHub releases.
  2. Build a clean Termux baseline.
  3. Add Git, SSH, Python/Node/PHP as needed.
  4. Add Shizuku only when an Android app genuinely benefits from ADB-level privileges.
  5. Add PRoot only when you need a conventional Linux distribution.
  6. Consider root only for a specific capability that the earlier layers cannot provide.

Access labels used here

Stock Works on a normal unrooted Android phone.

ADB Requires Android debugging privileges.

Shizuku Uses Shizuku's delegated ADB/root service.

Root Requires real superuser access.

Do not paste unknown commands Commands can delete projects, remove Android packages, expose network services, overwrite keys, or — at the root/fastboot layer — make a device unbootable. Read commands before running them. Commands in this guide use placeholders such as USER, SERVER, and PACKAGE.NAME on purpose.

01 — Know where you are

Many Android/Linux problems are really context problems. pkg, apt, dnf, systemctl, adb, and su do not all belong to the same environment.

Environment map
ANDROID DEVICE
│
├── Normal Android apps
│
├── Termux                         [STOCK]
│   ├── pkg / apt
│   ├── bash / zsh / fish
│   ├── git / ssh / python / node / php
│   ├── local web servers
│   └── ssh user@server ───────────────┐
│                                      │
├── PRoot-Distro                    [STOCK]
│   ├── Debian / Ubuntu / Alpine       │
│   ├── distro package manager         │
│   └── fake root inside container     │
│                                      ▼
├── ADB / Wireless Debugging        [ADB]       REMOTE VPS
│   └── Android shell privileges                 ├── AlmaLinux: dnf
│                                                ├── Debian: apt
├── Shizuku                      [SHIZUKU]       ├── sudo
│   └── delegated ADB/root APIs                 └── systemctl
│
└── Real Android root               [ROOT]
    ├── Magisk
    ├── KernelSU
    └── APatch

Fast environment check

whoami
pwd
uname -a
printf 'HOME=%s\nPREFIX=%s\n' "$HOME" "$PREFIX"
command -v pkg apt dnf systemctl sudo su 2>/dev/null
If you see…You are probably in…Typical package tool
/data/data/com.termux/files/homeTermuxpkg / apt
/root in a PRoot distroPRoot containerDistro-specific, often apt
/home/admin or server hostnameRemote Linux serverdnf, apt, etc.
uid=2000(shell)ADB shellAndroid shell commands; not a normal distro
uid=0(root) on AndroidActual root shellAndroid/root tooling; extreme care

02 — Install Termux correctly Verified 2026-08-29

Stock

As of this guide's verification date, the Termux project's position is unambiguous: F-Droid and the official GitHub releases are the only official installation sources. The Google Play release has diverged from the project's master branch and is treated by the project as a deprecated, unofficial fork with policy-driven differences and missing functionality. Because the Play build is signed with different keys, Play updates also fail against existing F-Droid/GitHub installs.[1][2][3]

Preferred sources

  1. F-Droid build: the recommended stable channel for most people.
  2. Official GitHub release: direct project builds — and required for certain add-on variants, such as the sharedUid Termux:X11 build covered later.
  3. Google Play build: deprecated and separately signed. The project does not recommend it; do not mix it with F-Droid/GitHub installs.
Never mix Termux app/plugin signing families. Termux plugins must be signed compatibly with the main Termux app. If you switch between F-Droid, GitHub, and Play signing families, uninstalling Termux and all plugins may be required. Back up $HOME first.[2]

After installation

pkg update
pkg upgrade

If repositories fail immediately, do not blindly run random “fix Termux repo” scripts from old videos. First check the installation source and current repository configuration.

03 — First boot & baseline

Stock

Minimal baseline

pkg update && pkg upgrade
pkg install git openssh curl wget nano vim tmux \
  python nodejs-lts php clang make pkg-config \
  zip unzip tar rsync jq tree file less man

Package names change over time. If one package is unavailable, remove it from the command and search:

pkg search NAME

Useful identity snapshot

echo "=== DEVICE ==="
uname -a
getprop ro.product.model 2>/dev/null
getprop ro.build.version.release 2>/dev/null

echo "=== TERMUX ==="
termux-info 2>/dev/null || true
echo "$PREFIX"
echo "$HOME"

echo "=== TOOLS ==="
git --version
ssh -V
python --version
node --version
php -v | head -n 1

Create work folders

mkdir -p ~/projects ~/scripts ~/tmp ~/notes
chmod 700 ~/.ssh 2>/dev/null || true

Safe baseline shell aliases

cat >> ~/.bashrc <<'EOF'
alias ll='ls -lah'
alias ..='cd ..'
alias ...='cd ../..'
alias gs='git status'
alias ports='ss -lntup 2>/dev/null || ss -lntp'
alias myip='curl -fsS https://api.ipify.org; echo'
EOF

source ~/.bashrc

04 — Files & Android storage

Stock

Termux private home

Your normal workspace is $HOME, commonly under Termux's private app storage. Android file managers generally cannot browse this directly because app sandboxes are intentional.

Shared storage

termux-setup-storage

Approve Android's permission prompt. Termux typically creates convenience links under ~/storage/.

ls -lah ~/storage
cd ~/storage/downloads
cd ~/storage/shared
Recommendation: keep Git repositories and software build trees in Termux private storage such as ~/projects. Use shared storage mainly for exchanging files with Android apps. Android shared storage can have permission and filesystem behavior that breaks Unix assumptions.

Move a file to Downloads

cp ~/projects/report/output.html ~/storage/downloads/

Import a file from Downloads

cp ~/storage/downloads/config.json ~/projects/myapp/

05 — Packages & repositories

Stock

TaskTermux command
Update package indexespkg update
Upgrade installed packagespkg upgrade
Installpkg install NAME
Removepkg uninstall NAME
Searchpkg search TEXT
List installedpkg list-installed
Package detailsapt show NAME

Optional repositories

# GUI/X11 packages
pkg install x11-repo

# Root-specific Termux packages — useful only on a rooted device
pkg install root-repo
Termux is not AlmaLinux Installing dnf is not how you turn Termux into AlmaLinux. If you need AlmaLinux administration, SSH into an AlmaLinux machine. If you need a distro-like local environment, use PRoot.

06 — Shell, keyboard & tmux

Stock

Touch-friendly terminal habits

  • Use Android's text-selection handles for copy/paste when available.
  • A hardware keyboard dramatically improves SSH and coding.
  • Use Termux's extra-keys row for ESC, CTRL, arrows, pipes, and tabs.
  • Use tmux for long-lived terminal sessions that survive accidental disconnects.

tmux essentials

tmux new -s work
tmux ls
tmux attach -t work

Inside tmux, the default command prefix is Ctrl+b. Common shortcuts: c new window, n next, p previous, d detach.

Zsh (optional)

pkg install zsh
zsh

Do not install a huge shell framework on day one. Start clean; add plugins only after the base environment is stable.

07 — Git & GitHub

Stock

Identity

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main

SSH key for Git hosting

mkdir -p ~/.ssh
chmod 700 ~/.ssh

ssh-keygen -t ed25519 -a 100 -C "android-termux"
cat ~/.ssh/id_ed25519.pub

Add the public key to your Git hosting account. Never upload or paste your private id_ed25519 file.

Clone and work

cd ~/projects
git clone git@github.com:OWNER/REPO.git
cd REPO
git status
git pull --ff-only

Normal commit loop

git status
git diff
git add path/to/file
git commit -m "Describe the change"
git push
Phone workflow: use Git as your safety net. Small commits are especially valuable on a mobile device where accidental app closure, battery loss, or storage pressure can interrupt work.

08 — SSH & server administration

Stock

Connect

ssh USER@SERVER

Create a dedicated key

ssh-keygen -t ed25519 -a 100 -f ~/.ssh/id_ed25519_server

SSH config aliases

cat >> ~/.ssh/config <<'EOF'
Host myserver
    HostName server.example.com
    User admin
    IdentityFile ~/.ssh/id_ed25519_server
    ServerAliveInterval 30
    ServerAliveCountMax 3
EOF

chmod 600 ~/.ssh/config
ssh myserver

Copy public key to server

ssh-copy-id -i ~/.ssh/id_ed25519_server.pub USER@SERVER

Transfer files

# phone -> server
scp file.zip USER@SERVER:/home/USER/

# server -> phone
scp USER@SERVER:/home/USER/report.txt .

# directory sync
rsync -av --progress ./site/ USER@SERVER:/var/www/site/

Port forwarding

# Make a remote service on 127.0.0.1:8080 reachable locally as 8080
ssh -L 8080:127.0.0.1:8080 USER@SERVER
Server shell vs Termux shell After ssh myserver, commands run on the server. If the server is AlmaLinux, dnf and systemctl belong there. Type exit to return to Termux.

09 — Python, Node, PHP & compilers

Stock

Python

pkg install python
python --version
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip

Node.js

pkg install nodejs-lts
node --version
npm --version

mkdir demo && cd demo
npm init -y

PHP

pkg install php
php -v

C/C++ build tools

pkg install clang make cmake pkg-config
clang --version

Native package caveat

Android is Linux-based but is not a standard GNU/Linux distribution. Some npm/pip packages assume glibc, systemd, desktop libraries, or kernel features that Termux does not expose. When a project fights Termux too hard, move the build to:

  • a PRoot distro,
  • your VPS,
  • GitHub Actions/CI, or
  • a conventional Linux workstation.

10 — Local web development

Stock

Simple static server

cd ~/projects/site
python -m http.server 8080

Open http://127.0.0.1:8080 in the phone browser.

PHP development server

php -S 127.0.0.1:8080 -t public

Vite-style development

npm install
npm run dev -- --host 127.0.0.1

LAN exposure — deliberate only

# Example: bind a test server to all interfaces
python -m http.server 8080 --bind 0.0.0.0
Network exposure Binding to 0.0.0.0 can make the service reachable by other devices on the same network. Do not expose admin panels, dev servers, databases, or secrets to untrusted Wi-Fi.

11 — Databases

Stock

SQLite — ideal on-device default

pkg install sqlite
sqlite3 app.db

Server databases

For production MySQL/MariaDB/PostgreSQL, your remote VPS is usually the cleaner target. On-device database servers are useful for testing, but Android process lifecycle and storage limits make a phone a poor unattended production database host.

Never expose a database directly to the Internet

Use application APIs, VPN/private networking, or an SSH tunnel instead of making database ports globally reachable.

12 — Termux:API & Android integration

Stock

Termux:API exposes selected Android APIs to scripts. The add-on app and main Termux app need compatible signing, and the command package must be installed inside Termux.[4]

pkg install termux-api

Examples

# Show a notification
termux-notification --title "Termux" --content "Task finished"

# Clipboard
printf 'hello from Termux' | termux-clipboard-set
termux-clipboard-get

# Device battery information
termux-battery-status | jq

# Vibrate briefly
termux-vibrate -d 200

# Text to speech
termux-tts-speak "Build complete"

Actual availability depends on Android version, Termux distribution, app permissions, and the installed Termux:API build.

13 — Termux add-ons

Stock

Add-onWhat it doesUse case
Termux:APIAndroid APIs from commands/scriptsnotifications, clipboard, battery, sensors, TTS, etc.
Termux:BootRun scripts after bootstart lightweight automation
Termux:WidgetHome-screen shortcuts to scriptsone-tap server checks and utilities
Termux:TaskerTasker ↔ Termux command integrationevent-driven automation
Termux:FloatFloating terminalquick terminal over another app
Termux:StylingFonts/themes for TermuxUI customization
Plugin availability and behavior differ by Termux distribution. Because the Google Play branch is deprecated and separately signed, do not assume Play plugin builds match F-Droid/GitHub plugin behavior — mixing them can force a full reinstall.[2]

14 — Third-party companion apps

These apps are not required. Add them because they solve a specific workflow problem, not because a “power user pack” told you to install everything.

Shizuku

ADB Shizuku

Lets compatible apps use privileged Android APIs through an ADB or root-backed service without giving every app unrestricted root.[9] Covered in depth in section 16.

Obtainium

Stock

Tracks and installs Android app releases directly from supported upstream sources such as GitHub/GitLab. Useful when you intentionally use project APKs outside Play.[17]

aShell You

ADB Shizuku

GUI-oriented ADB/root/shell tool that can use Shizuku, root, OTG, or wireless debugging depending on the operation.[18]

LADB

ADB

Runs a local ADB client/server workflow using Android Wireless Debugging. Its own documentation warns of incompatibility with Shizuku in some setups, so choose one workflow rather than stacking tools blindly.[19]

Acode

Stock

Android-focused code editor useful for HTML/CSS/JS and quick edits when a full terminal editor is inconvenient.[20]

Material Files

Stock

A capable Android file manager. Useful for shared storage and ordinary files, but it does not bypass Android's app sandbox.[21]

Other useful categories

  • Password manager: store server logins and recovery material securely; do not keep plaintext secrets in Downloads.
  • Authenticator: use TOTP/passkeys for Git hosting and server control panels.
  • SFTP client: optional if you prefer GUI file transfer over scp/rsync.
  • VNC/RDP client: useful for remote desktops; do not confuse this with Termux:X11, which displays local Linux GUI apps.
  • Tasker: powerful automation layer when Termux:Tasker or Android intents are appropriate.

15 — ADB & Wireless Debugging Verified 2026-08-29

ADB

ADB is Android's developer bridge. It is more privileged than an ordinary app, but ADB shell is not root. Modern Android supports wireless debugging on Android 11+; newer platform releases continue improving Wi-Fi pairing.[10]

Developer options

  1. Open Android Settings → About phone.
  2. Tap Build number repeatedly until Developer options are enabled.
  3. Open Developer options.
  4. Enable USB debugging or Wireless debugging as needed.

From a separate computer

adb devices
adb shell
adb reboot bootloader

Wireless pairing concept

# Commands and ports shown by Android change per pairing session.
adb pair IP:PAIRING_PORT
adb connect IP:ADB_PORT
adb shell

Useful read-only diagnostics

adb shell getprop ro.product.model
adb shell getprop ro.build.version.release
adb shell pm list packages | head
adb shell dumpsys battery
adb shell df -h
High-risk ADB operations: package removal/disable commands, permission manipulation, system settings writes, and shell scripts copied from debloat lists can break apps or device functionality. Export a package list and understand reversibility before changing anything.

16 — Shizuku Verified 2026-08-29

Shizuku

Shizuku acts as a broker: compatible apps can call privileged system APIs through a service started with ADB-level or root privileges. It is not magic root and does not grant arbitrary Linux root to every app.[9]

Unrooted setup on Android 11+

  1. Install Shizuku from a trusted source.
  2. Enable Developer options and Wireless debugging.
  3. Use “Pair device with pairing code.”
  4. Enter the pairing code into Shizuku's notification.
  5. Start the Shizuku service.
  6. Grant Shizuku access only to apps you trust.
On an unrooted device, Shizuku's wireless-debugging service must be started again after every reboot — that is a documented system limitation, not a bug in your setup.[9] Root-backed Shizuku can start on boot instead.

Fast restart without re-pairing

If you have ADB access (from a computer, or an on-device ADB shell), you can restart the Shizuku service directly without repeating the full pairing flow:

adb shell sh /sdcard/Android/data/moe.shizuku.privileged.api/start.sh

Where available, also enable “Disable adb authorization timeout” in Developer options — it extends the life of the wireless debugging session.[9]

What it is good for

  • Package-management helpers.
  • App permission managers.
  • ADB-shell-style utilities.
  • Some backup, automation, and system-management apps.

What it is not

  • A replacement for an unlocked bootloader.
  • A way to flash boot partitions.
  • Full unrestricted root.
  • A reason to authorize random apps.

17 — Full Linux with PRoot-Distro

Stock

PRoot-Distro provides chroot-like Linux environments without device root or a kernel module. Current versions can work with conventional distro root filesystems and OCI/container images while staying inside the Termux app sandbox.[7]

Install

pkg install proot-distro
proot-distro list

Install a distro

# Use an alias shown by `proot-distro list`
proot-distro install debian
proot-distro login debian

Inside Debian

apt update
apt upgrade
apt install git curl build-essential

Why root appears inside PRoot

You may see a root@localhost prompt. That is not Android root. PRoot emulates filesystem/process behavior so the distro thinks you are root inside that container-like environment. It does not give you unrestricted access to Android's protected partitions.

Use PRoot when

  • a project expects Debian/Ubuntu filesystem layout,
  • software assumes a conventional distro package manager,
  • you want a desktop environment,
  • you need packages that are awkward in native Termux.

Avoid PRoot when

  • native Termux packages already solve the problem,
  • you need real kernel features, Docker daemon semantics, systemd-as-PID-1, or privileged mounts,
  • performance matters more than compatibility.

18 — GUI Linux & Termux:X11 Verified 2026-08-29

Stock

Termux:X11 is the Termux project's X server add-on. It requires both an Android app and a companion Termux package, and Android 8 or later.[8]

Termux-side packages

pkg install x11-repo
pkg install termux-x11-nightly
pkg install xfce

The companion Android Termux:X11 APK must also be installed from the project's current nightly release tag (termux-x11-universal-debug.apk).[8]

GitHub-only variant worth knowing: Android gives less CPU time to apps that are not on screen — and once Termux:X11 opens, Android treats Termux as backgrounded, which can slow your desktop apps. The termux-x11-universal-sharedUid-debug.apk variant runs as part of Termux itself and avoids this, but it only works with the GitHub-signed Termux build, not F-Droid or Play.[8]

Typical native-Termux XFCE concept

termux-x11 :1 &
export DISPLAY=:1
startxfce4

Exact launch flags evolve. Use the current Termux:X11 README when configuring it.

GUI inside PRoot

You can also run an XFCE/LXQt-style desktop inside Debian/Ubuntu PRoot and display it through Termux:X11. This increases compatibility at the cost of storage, RAM, and complexity.

Do not expect a phone GUI distro to behave like a laptop install. Android owns the kernel, process lifecycle, input stack, power management, and hardware integration. Linux GUI apps are guests inside that environment.

19 — Turning a phone into a workstation

Stock

Useful hardware

  • USB-C hub with USB-A and power pass-through.
  • Compact Bluetooth or USB keyboard.
  • Mouse or trackpad.
  • Portable USB-C display if the phone supports suitable display output, or a wireless/remote-display workflow otherwise.
  • USB-C PD power bank.
  • Small SSD or flash drive for transfers/backups.

Recommended software split

JobBest layer
Fast shell, SSH, GitNative Termux
Editing a few web filesTermux editor or Acode
Conventional Linux packagesPRoot distro
Desktop Linux GUI appTermux:X11 + native/PRoot app
Real production serverRemote VPS over SSH
Android privileged managementADB/Shizuku first; root only if necessary

20 — What happened to rooting?

Root

Rooting did not die. What changed is that root stopped being the universal answer to Android customization.

Why root used to feel essential

  • Early Android lacked many quality-of-life features now built into the OS.
  • Power users wanted ad blocking, full backups, tethering changes, CPU controls, themes, permission control, and deeper automation.
  • OEM software was often more restrictive while Android itself exposed fewer user-facing controls.

Why it became less common

  1. Android got better. Many old root-only conveniences became standard OS features or possible through normal apps.
  2. ADB got more useful. Wireless Debugging made developer-shell workflows much easier.
  3. Shizuku filled a middle layer. Some apps can use privileged Android APIs without full root.
  4. Android security hardened. SELinux, app sandboxing, Verified Boot/AVB, scoped storage, rollback protection, hardware-backed key systems, and integrity attestation raised the cost of modifying the platform.
  5. Apps care about integrity state. Financial, streaming, workplace, DRM, and game apps may restrict modified devices.
  6. OTA updates are more complex with modifications. A/B slots and modern boot partition layouts make careless patching more expensive.
  7. Bootloaders are not equally unlockable. Manufacturer/carrier policy varies by exact model.

What root is still excellent for

  • Kernel-level experimentation and tuning.
  • Full-device automation requiring genuine superuser access.
  • Advanced firewall/network control.
  • Deep filesystem inspection and forensic lab work on a device you own/control.
  • Systemless modules and low-level customization.
  • Development/testing of root-aware software.

The modern rule

Root because you can name the capability you need. “I want Linux commands” is not enough. “I need a kernel module / root firewall / protected filesystem access / root-only test environment” is a concrete reason.

21 — Bootloader, Verified Boot & partitions

Root High risk

Modern Android uses a chain of trust. Verified Boot checks that boot-critical software matches trusted cryptographic metadata. An unlocked bootloader allows owner-directed flashing on devices that support unlocking, but the security state changes and Android shows an unlocked-device warning.[11][12]

Unlocking normally wipes user data

Android's reference design requires a data wipe when transitioning between locked and unlocked bootloader states. Back up first.[11]

Core terms

TermMeaning
BootloaderEarly-stage software that initializes hardware, verifies boot state, and starts Android.
FastbootBootloader protocol/tool for supported devices.
AVBAndroid Verified Boot; cryptographic verification/rollback-protection framework.
bootCommonly contains kernel and/or ramdisk data depending on device generation.
init_bootSeparate init ramdisk partition on devices launched with Android 13+.
vendor_bootVendor boot components on newer partition layouts.
A/B slotsTwo update slots that let Android apply OTAs with reduced downtime and support fallback behavior.
Never generalize partition instructions across devices. Magisk, KernelSU, and APatch do not necessarily patch the same partition on every device. The correct image depends on device, Android release, kernel, rooting method, and project instructions.

22 — Magisk vs KernelSU vs APatch Verified 2026-08-29

Root

SystemModelStrengthsImportant caveat
Magisk[13] Userspace systemless root via patched boot/init image Largest ecosystem: MagiskSU, modules, built-in Zygisk, broad device familiarity. Actively maintained — v30.7 (February 2026) added Android 16 QPR2 sepolicy and Zygisk support. Correct patch target varies by device generation (boot vs init_boot); use current official install docs.
KernelSU[14] Kernel-space root Kernel-level permission model and app profiles. Two modes: LKM (load into the existing kernel by patching the ramdisk — init_boot on Android 13+) and GKI (flash KernelSU's kernel). Officially targets GKI 2.0 devices (kernel 5.10+); wrong kernel/KMI or compression format can bootloop. The community KernelSU-Next fork extends coverage to many older/non-GKI kernels.[15]
APatch[16] Kernel patching (KernelPatch) via modified boot.img No kernel rebuild needed: patches the stock boot image and injects kernel patches at runtime. APM (Magisk-style) modules plus KPM (kernel-space) modules. ARM64 only; kernel versions 3.18–6.12; requires CONFIG_KALLSYMS in the kernel. The SuperKey credential is more privileged than root — guard it like a master password.
One root system per device. Magisk's mount system conflicts with KernelSU/APatch module mounting — running two of them on the same boot slot will break one or both. Pick one, and uninstall cleanly before switching.

Selection rule

  • Choose based on exact device + exact firmware + exact kernel, not popularity.
  • Prefer the project's official documentation and device-specific community evidence.
  • Keep the matching stock firmware image before modifying anything.
  • Do not flash an image prepared for a different build number or security patch level.

23 — Generic root workflow

Root High risk

This section intentionally gives the workflow rather than a blind device-specific paste script. Rooting is one place where “universal commands” can cause real damage.

  1. Confirm the exact device model and carrier variant.
  2. Confirm whether OEM unlocking is supported.
  3. Back up all user data — bootloader unlock usually wipes the phone.
  4. Record the current build number, Android version, security patch, and kernel version.
  5. Download the exact matching factory firmware from the device/OEM source.
  6. Keep untouched copies of relevant stock images.
  7. Install current Android Platform Tools on the computer/device used for fastboot.
  8. Enable OEM unlocking and USB debugging when supported.
  9. Unlock the bootloader using the device maker's supported method.
  10. Boot Android again and complete the post-wipe setup.
  11. Select Magisk/KernelSU/APatch based on verified device support.
  12. Patch only the image/partition required by that rooting method for that device.
  13. If supported, temporarily boot a test image before permanent flashing.
  14. Flash only after confirming filename, partition, firmware match, and recovery plan.
  15. Verify boot, root manager state, calls/SMS/data, Wi-Fi/Bluetooth, camera, and critical apps.

Fastboot orientation commands

adb devices
adb reboot bootloader
fastboot devices

# Read device variables where supported
fastboot getvar current-slot
fastboot getvar product
Do not copy a generic fastboot flash boot ... command until the chosen root project's instructions say that boot is the correct target for your exact device/mode.

24 — Root recovery & bootloops

Root Recovery

Before modifying anything, have

  • Exact stock factory image / firmware.
  • Stock boot.img and any other relevant original images.
  • Working USB cable.
  • Known-good fastboot setup.
  • Battery well above emergency level.
  • Account credentials needed after a wipe.
  • A second device or computer to read recovery instructions.

If a patched boot image fails

The usual recovery concept is to return to bootloader/fastboot and restore the exact stock image that was modified, or use the OEM's official factory restore mechanism. The exact command and partition depend on the device.

Do not relock blindly

Relocking while modified/unverified partitions remain can make recovery harder. Restore a known stock configuration first, then follow OEM-specific relock instructions.

Anti-rollback matters

Modern devices can enforce rollback protection. Older firmware or mismatched security patch levels may not boot even if the hardware model appears correct.

25 — Networking field kit

Stock

Install tools

pkg install curl wget dnsutils inetutils iproute2 openssh nmap netcat-openbsd

HTTP

curl -I https://example.com
curl -fsSL https://example.com/api/status | jq

DNS

dig example.com
nslookup example.com

Connectivity

ping -c 4 1.1.1.1
traceroute example.com

Listening sockets

ss -lntp
ss -lnup

Port test

nc -vz SERVER 22
nc -vz SERVER 443

SSH service inside Termux

pkg install openssh
passwd
sshd
whoami
ip addr

Termux's SSH daemon normally uses a nonstandard port such as 8022. Confirm current configuration rather than assuming.

Security boundary Network diagnostics are legitimate administrative tools. Only scan systems you own or have permission to test. Keep phone-hosted services bound to localhost unless you deliberately need LAN access.

26 — Automation

Termux scripts

Stock

mkdir -p ~/scripts
cat > ~/scripts/server-health.sh <<'EOF'
#!/data/data/com.termux/files/usr/bin/bash
set -euo pipefail
ssh myserver 'uptime; df -h /; systemctl --failed --no-pager'
EOF
chmod 700 ~/scripts/server-health.sh

Termux:Tasker

Termux:Tasker allows Tasker to execute Termux commands. Modern Termux includes a permission-gated RUN_COMMAND mechanism specifically to prevent arbitrary apps from executing commands in the Termux context.[5][6]

Do not grant Termux command-execution permission casually. A trusted automation app with permission to execute Termux commands can potentially act with all capabilities available to Termux — and if Termux itself has root, that can become much more powerful.

Good automation examples

  • One-tap SSH health check.
  • Git pull + static-site build.
  • Notify when a local build finishes.
  • Copy a generated report to Downloads.
  • Start a tmux workspace.
  • Back up selected Termux configuration to an encrypted archive.

27 — Security rules

1. Treat SSH keys as credentials

chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519*
chmod 600 ~/.ssh/config 2>/dev/null || true

Public keys end in .pub and may be shared. Private keys should not.

2. Do not keep secrets in shell history

Avoid commands like:

# Bad pattern — secret becomes part of command history
curl -H "Authorization: Bearer ACTUAL_SECRET" ...

Prefer environment files with strict permissions, a secret manager, or interactive input where practical.

3. Verify APK sources

For sideloaded tools, prefer the developer's documented repository/release channel. Avoid random APK mirrors, repacks, “premium unlocked” builds, and Telegram uploads with no verifiable provenance.

4. Minimize elevated layers

If native Termux solves it, do not use ADB. If ADB solves it, do not use root. If Shizuku can give one app the needed API, do not give that app unrestricted su.

5. Root modules are code with extreme privileges

A root module can alter boot behavior, policies, networking, and system state. Treat modules like kernel-adjacent software, not phone themes. This applies double to kernel-space modules such as APatch KPMs — a faulty or hostile KPM can compromise the entire device, not just an app.[16]

28 — Android limits & background killing

Termux runs as an Android app. Android can restrict background work to protect battery and memory. This is why “my server died when the screen was off” does not automatically mean your script is broken.

Mitigation

  • Allow Termux appropriate background/battery permissions for workflows that genuinely need them.
  • Use tmux for interactive session resilience.
  • Use termux-wake-lock only when a task genuinely needs to keep the CPU awake, then release it.
  • Prefer a VPS for services that must run 24/7.
termux-wake-lock
# run required job
termux-wake-unlock

systemd note

Termux is not a normal systemd boot environment. PRoot is also not equivalent to a VM with its own kernel and init system. If a tutorial assumes systemctl enable --now ..., first ask whether you are actually on a real Linux server.

29 — Backup & rebuild

Stock

What matters most

  • ~/.ssh
  • Git repositories with unpushed work
  • ~/.gitconfig
  • shell rc files
  • ~/.termux
  • automation scripts
  • database files
  • project-specific .env files — encrypted or otherwise protected

Export package list

pkg list-installed > ~/termux-packages.txt

Create a configuration archive

tar -czf ~/storage/downloads/termux-config-backup.tgz \
  ~/.ssh ~/.gitconfig ~/.bashrc ~/.termux ~/scripts 2>/dev/null
That archive may contain private keys. Do not upload it to a public cloud bucket, Git repository, or shared folder unencrypted.

Projects

The strongest project backup is usually a clean Git history pushed to a remote repository. For private untracked data, maintain a separate encrypted backup strategy.

30 — Troubleshooting encyclopedia

dnf: command not found

You are likely in Termux or a Debian-like PRoot environment, not AlmaLinux. Run:

pwd
uname -a
echo "$PREFIX"

If your goal is the AlmaLinux VPS, SSH into it first.

sudo: command not found

Normal Termux does not need or provide desktop-style sudo. Packages install into Termux's own prefix as your app user. On a real remote server, use that server's sudo setup. On a rooted Android device, root access is typically obtained through the root manager's su implementation.

pkg / repository errors
  1. Run termux-info.
  2. Confirm Termux came from a supported source (F-Droid or official GitHub releases).
  3. Do not mix F-Droid, GitHub, and Play plugin APKs.
  4. Run pkg update.
  5. Check current Termux project issue/status documentation before applying old mirror hacks.
Storage permission denied
termux-setup-storage
ls -lah ~/storage

Also check Android Settings → Apps → Termux permissions. Some protected Android directories remain intentionally inaccessible even after shared-storage permission.

SSH host key changed

Do not automatically delete the warning. First determine whether the server was rebuilt or the address now points to a different machine. If the change is expected, remove only the specific stale host key:

ssh-keygen -R SERVER
SSH disconnects when phone sleeps

Use tmux on the remote host, adjust Android background restrictions where justified, and use SSH keepalives. For long-running server work, the process itself should run on the server, not depend on the phone staying connected.

Node package fails to compile

Check CPU architecture and native dependencies:

uname -m
node -p "process.arch"
pkg install clang make python pkg-config

If the module assumes glibc or unsupported system libraries, build it on a conventional Linux environment or use PRoot/VPS.

Python package fails during pip install
python -m pip install --upgrade pip setuptools wheel
pkg install clang make pkg-config

Then inspect the actual compiler error. Do not keep rerunning pip with random flags. Some wheels simply are not published for Android/Termux.

Shizuku stops after reboot

Expected in the common unrooted Wireless Debugging workflow — this is a documented system limitation. Re-start the Shizuku service after reboot, or use the fast-restart command from section 16. Root-backed Shizuku can start on boot.[9]

Termux:X11 shows a black screen
  • Confirm both the Android Termux:X11 app and Termux package are installed.
  • Confirm DISPLAY.
  • Kill stale X11/desktop processes before restarting.
  • Check current project README flags because nightly behavior evolves.
  • Test a simple X application before debugging a full desktop.
PRoot says I am root — is my phone rooted?

No. PRoot's “root” is inside the emulated/container-like userspace. Check actual Android root separately with a trusted root manager or by testing su -c id only if you intentionally installed root.

Bootloop after root patch

Stop flashing random images. Use the known-good bootloader/fastboot recovery path and exact stock firmware for the current build. Restore the partition altered by your root method or use the OEM factory restore process. Do not relock until stock state is confirmed.

31 — Command cheat sheets

Termux navigation

pwd                 # current directory
ls -lah              # list files
cd ~/projects        # change directory
mkdir project        # create directory
cp A B               # copy
mv A B               # move/rename
rm file              # delete file — irreversible in shell
du -sh *              # sizes
df -h                 # filesystem usage
find . -name '*.php'  # find files

Process inspection

ps -ef
pgrep -af node
top
kill PID

Git

git status
git diff
git log --oneline --decorate -20
git pull --ff-only
git add FILE
git commit -m "message"
git push

SSH

ssh myserver
scp file myserver:/tmp/
rsync -av ./dir/ myserver:/path/
ssh -L 8080:127.0.0.1:8080 myserver

HTTP/DNS

curl -I https://example.com
curl -fsS https://example.com
dig example.com
ping -c 4 example.com
ss -lntp

Know your environment

whoami
id
pwd
uname -a
echo "$HOME"
echo "$PREFIX"
cat /etc/os-release 2>/dev/null || true

Remote Linux server

# AlmaLinux / RHEL family
sudo dnf update

# Debian / Ubuntu
sudo apt update
sudo apt upgrade

# systemd servers
systemctl status SERVICE
sudo systemctl restart SERVICE

32 — Sources & verification

This guide was checked against current primary/project documentation on August 29, 2026. Inline [n] markers throughout the guide point to the sources below. Root procedures are intentionally generic because exact partition instructions must be matched to the device and firmware.

  1. Termux app / installation: https://github.com/termux/termux-app
  2. Google Play release status (official announcement): https://github.com/termux/termux-app/discussions/4000
  3. Termux website/docs: https://termux.dev/
  4. Termux:API: https://github.com/termux/termux-api
  5. Termux:Tasker: https://github.com/termux/termux-tasker
  6. RUN_COMMAND Intent: https://github.com/termux/termux-app/wiki/RUN_COMMAND-Intent
  7. PRoot-Distro: https://github.com/termux/proot-distro
  8. Termux:X11: https://github.com/termux/termux-x11
  9. Shizuku setup guide: https://shizuku.rikka.app/guide/setup/
  10. Android ADB/Wireless Debugging: https://developer.android.com/studio/run/device
  11. Android bootloader locking/unlocking: https://source.android.com/docs/core/architecture/bootloader/locking_unlocking
  12. Android Verified Boot: https://source.android.com/docs/security/features/verifiedboot
  13. Magisk (repo + releases): https://github.com/topjohnwu/Magisk — https://github.com/topjohnwu/Magisk/releases
  14. KernelSU installation: https://kernelsu.org/guide/installation.html
  15. KernelSU-Next (community fork): https://github.com/KernelSU-Next/KernelSU-Next
  16. APatch: https://apatch.dev/ — https://github.com/bmax121/APatch
  17. Obtainium: https://github.com/ImranR98/Obtainium
  18. aShell You: https://github.com/DP-Hridayan/aShellYou
  19. LADB: https://github.com/tytydraco/LADB
  20. Acode: https://github.com/Acode-Foundation/Acode
  21. Material Files: https://github.com/zhanghai/MaterialFiles
Verification rule: before rooting, flashing, installing a root module, or changing Android packages, re-check the official documentation. Android moves fast, and root instructions are unusually sensitive to device generation, firmware build, security patch level, partition layout, and kernel.
PUBLIC RELEASE — v1.0

Created and maintained by William Lodge. Independent educational project; not an official Termux publication and not affiliated with the Termux project. Guide content is licensed under CC BY 4.0.

Find this useful? Buy me a coffee.