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.
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
- Install stable Termux from F-Droid or the official GitHub releases.
- Build a clean Termux baseline.
- Add Git, SSH, Python/Node/PHP as needed.
- Add Shizuku only when an Android app genuinely benefits from ADB-level privileges.
- Add PRoot only when you need a conventional Linux distribution.
- 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.
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.
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/home | Termux | pkg / apt |
/root in a PRoot distro | PRoot container | Distro-specific, often apt |
/home/admin or server hostname | Remote Linux server | dnf, apt, etc. |
uid=2000(shell) | ADB shell | Android shell commands; not a normal distro |
uid=0(root) on Android | Actual root shell | Android/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
- F-Droid build: the recommended stable channel for most people.
- Official GitHub release: direct project builds — and required for certain add-on variants, such as the sharedUid Termux:X11 build covered later.
- Google Play build: deprecated and separately signed. The project does not recommend it; do not mix it with F-Droid/GitHub installs.
$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
~/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
| Task | Termux command |
|---|---|
| Update package indexes | pkg update |
| Upgrade installed packages | pkg upgrade |
| Install | pkg install NAME |
| Remove | pkg uninstall NAME |
| Search | pkg search TEXT |
| List installed | pkg list-installed |
| Package details | apt 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
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
tmuxfor 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
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
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
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-on | What it does | Use case |
|---|---|---|
| Termux:API | Android APIs from commands/scripts | notifications, clipboard, battery, sensors, TTS, etc. |
| Termux:Boot | Run scripts after boot | start lightweight automation |
| Termux:Widget | Home-screen shortcuts to scripts | one-tap server checks and utilities |
| Termux:Tasker | Tasker ↔ Termux command integration | event-driven automation |
| Termux:Float | Floating terminal | quick terminal over another app |
| Termux:Styling | Fonts/themes for Termux | UI customization |
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
- Open Android Settings → About phone.
- Tap Build number repeatedly until Developer options are enabled.
- Open Developer options.
- 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
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+
- Install Shizuku from a trusted source.
- Enable Developer options and Wireless debugging.
- Use “Pair device with pairing code.”
- Enter the pairing code into Shizuku's notification.
- Start the Shizuku service.
- Grant Shizuku access only to apps you trust.
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]
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.
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
| Job | Best layer |
|---|---|
| Fast shell, SSH, Git | Native Termux |
| Editing a few web files | Termux editor or Acode |
| Conventional Linux packages | PRoot distro |
| Desktop Linux GUI app | Termux:X11 + native/PRoot app |
| Real production server | Remote VPS over SSH |
| Android privileged management | ADB/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
- Android got better. Many old root-only conveniences became standard OS features or possible through normal apps.
- ADB got more useful. Wireless Debugging made developer-shell workflows much easier.
- Shizuku filled a middle layer. Some apps can use privileged Android APIs without full root.
- 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.
- Apps care about integrity state. Financial, streaming, workplace, DRM, and game apps may restrict modified devices.
- OTA updates are more complex with modifications. A/B slots and modern boot partition layouts make careless patching more expensive.
- 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
| Term | Meaning |
|---|---|
| Bootloader | Early-stage software that initializes hardware, verifies boot state, and starts Android. |
| Fastboot | Bootloader protocol/tool for supported devices. |
| AVB | Android Verified Boot; cryptographic verification/rollback-protection framework. |
boot | Commonly contains kernel and/or ramdisk data depending on device generation. |
init_boot | Separate init ramdisk partition on devices launched with Android 13+. |
vendor_boot | Vendor boot components on newer partition layouts. |
| A/B slots | Two update slots that let Android apply OTAs with reduced downtime and support fallback behavior. |
22 — Magisk vs KernelSU vs APatch Verified 2026-08-29
Root
| System | Model | Strengths | Important 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. |
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.
- Confirm the exact device model and carrier variant.
- Confirm whether OEM unlocking is supported.
- Back up all user data — bootloader unlock usually wipes the phone.
- Record the current build number, Android version, security patch, and kernel version.
- Download the exact matching factory firmware from the device/OEM source.
- Keep untouched copies of relevant stock images.
- Install current Android Platform Tools on the computer/device used for fastboot.
- Enable OEM unlocking and USB debugging when supported.
- Unlock the bootloader using the device maker's supported method.
- Boot Android again and complete the post-wipe setup.
- Select Magisk/KernelSU/APatch based on verified device support.
- Patch only the image/partition required by that rooting method for that device.
- If supported, temporarily boot a test image before permanent flashing.
- Flash only after confirming filename, partition, firmware match, and recovery plan.
- 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
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.imgand 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.
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]
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
tmuxfor interactive session resilience. - Use
termux-wake-lockonly 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
.envfiles — 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
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
- Run
termux-info. - Confirm Termux came from a supported source (F-Droid or official GitHub releases).
- Do not mix F-Droid, GitHub, and Play plugin APKs.
- Run
pkg update. - 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.
- Termux app / installation: https://github.com/termux/termux-app
- Google Play release status (official announcement): https://github.com/termux/termux-app/discussions/4000
- Termux website/docs: https://termux.dev/
- Termux:API: https://github.com/termux/termux-api
- Termux:Tasker: https://github.com/termux/termux-tasker
- RUN_COMMAND Intent: https://github.com/termux/termux-app/wiki/RUN_COMMAND-Intent
- PRoot-Distro: https://github.com/termux/proot-distro
- Termux:X11: https://github.com/termux/termux-x11
- Shizuku setup guide: https://shizuku.rikka.app/guide/setup/
- Android ADB/Wireless Debugging: https://developer.android.com/studio/run/device
- Android bootloader locking/unlocking: https://source.android.com/docs/core/architecture/bootloader/locking_unlocking
- Android Verified Boot: https://source.android.com/docs/security/features/verifiedboot
- Magisk (repo + releases): https://github.com/topjohnwu/Magisk — https://github.com/topjohnwu/Magisk/releases
- KernelSU installation: https://kernelsu.org/guide/installation.html
- KernelSU-Next (community fork): https://github.com/KernelSU-Next/KernelSU-Next
- APatch: https://apatch.dev/ — https://github.com/bmax121/APatch
- Obtainium: https://github.com/ImranR98/Obtainium
- aShell You: https://github.com/DP-Hridayan/aShellYou
- LADB: https://github.com/tytydraco/LADB
- Acode: https://github.com/Acode-Foundation/Acode
- Material Files: https://github.com/zhanghai/MaterialFiles