agentleFS
Alex72-pyAlex72-py/termux-elite/skills/termux-backup/SKILL.md

termux-backup

Skill2 starsChanged 57 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

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
  1. Very specific:

    Before a large pkg upgrade, a proot distro reset or removal, reinstalling Termux, or a mass package change.

    line 16
  2. Distinctive:

    When the user asks to back up, clone, or migrate a Termux setup.

    line 17
  3. Very specific:

    Run sh scripts/estimate-backup-size.sh [target-dir] (read-only).

    line 24

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. Home only is usually enough: packages can be reinstalled. Record the package list as text (dpkg --get-selections) alongside it.
  2. 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.
  3. The documented method is a tar of /data/data/com.termux/files limited to ./home and ./usr, written outside the directories being archived. Run it from Termux itself.
  4. Exclude regenerable caches (package caches, node_modules, .cache) when size matters, and say what was excluded.
  5. The archive contains secrets (~/.ssh, tokens, shell history). Treat it as sensitive: do not upload it anywhere unencrypted.
  6. 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.
  7. 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).
  8. 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 ./home and ./usr with 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-environment for architecture and free space.
  • storage-permissions when the target is shared storage.
  • proot-boundaries before destructive distro operations.
  • package-troubleshooting when 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).

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.