termux-backup
Skill1 starsChanged 58 days agoMITView on GitHub
Create and verify a restorable snapshot of Termux home and prefix before risky changes, and restore it safely. Use when about to do a major upgrade, proot reset, Termux reinstall, or mass package change, or when asked to back up or migrate Termux. Do NOT use as a substitute for version control of project code, and do not restore over a working installation without explicit confirmation.
- Reads credentials
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- background-processesSkill
- git-credentialsSkill
- github-actionsSkill
- node-native-buildSkill
- package-troubleshootingSkill
- proot-boundariesSkill
- python-native-buildSkill
- storage-permissionsSkill
- termux-adbSkill
- termux-apiSkill
- termux-environmentSkill
- termux-networkSkill
- termux-servicesSkill
- termux-sshdSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
Before a large pkg upgrade, a proot distro reset or removal, reinstalling Termux, or a mass package change.
- Distinctive: line 17
When the user asks to back up, clone, or migrate a Termux setup.
- Very specific: line 24
Run sh scripts/estimate-backup-size.sh [target-dir] (read-only).
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Termux Backup and Restore
Purpose
Make a verified, restorable archive of Termux state before a risky change, and restore it only deliberately.
When to use
- Before a large
pkg upgrade, a proot distro reset or removal, reinstalling Termux, or a mass package change. - When the user asks to back up, clone, or migrate a Termux setup.
When NOT to use
- To protect project code: that belongs in git on a remote.
- To restore over a working installation without a clear reason and explicit confirmation.
Preconditions
Run sh scripts/estimate-backup-size.sh [target-dir] (read-only). Decide scope: home only (small, holds your files and config) or home plus prefix (large, holds installed packages). Confirm there is room at the target and that storage access exists if the target is shared storage (storage-permissions).
Decision tree
- Home only is usually enough: packages can be reinstalled. Record the package list as text (
dpkg --get-selections) alongside it. - Full backup (home and prefix) is the documented way to move or recover an entire installation. It only restores cleanly onto the same CPU architecture and the same app package id.
- The documented method is a tar of
/data/data/com.termux/fileslimited to./homeand./usr, written outside the directories being archived. Run it from Termux itself. - Exclude regenerable caches (package caches,
node_modules,.cache) when size matters, and say what was excluded. - The archive contains secrets (
~/.ssh, tokens, shell history). Treat it as sensitive: do not upload it anywhere unencrypted. - Shared storage cannot hold Unix modes or symlinks, but a tar archive stored there keeps them inside the file. Do not extract archives on shared storage.
- Restore is destructive: it replaces files under home and prefix. Restore only into a fresh or intentionally replaced installation, with the same flags the documentation specifies (preserve permissions, replace existing files).
- For proot distros, prefer the distro's own backup command where the installed version has one.
Example
- Situation: A major pkg upgrade is planned on a device holding unpushed work.
- Without the skill: Copies the home directory to /sdcard, which drops modes and symlinks, or skips the backup.
- With the skill: Archives
./homeand./usrwith tar to a path outside both, records the package list, states what was excluded, treats the archive as secret, and verifies by listing it.
Safety
Creating an archive writes a large file and uses storage; state size and destination first. Restoring overwrites files: name what will be replaced and get explicit confirmation. Never print archive contents beyond a name listing.
Verification
List the archive (tar -tzf <archive>) and confirm expected top-level entries and non-trivial size. For a restore, take a fresh environment snapshot (termux-environment) afterwards and test one package and one config file.
Rollback
A backup needs none. For a restore, keep the previous state's archive until the restored installation is verified.
Handoffs
termux-environmentfor architecture and free space.storage-permissionswhen the target is shared storage.proot-boundariesbefore destructive distro operations.package-troubleshootingwhen an upgrade is the reason for the backup.
Report
Scope and exclusions, archive path and size, listing check result, and the one-line restore command appropriate to that archive (not run).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

