A Rust program to backup and restore your Termux home and sysroot directories.
- Download and extract the latest
.tar.gzarchive for your architecture:Or download it directly from GitHub Releases, extractcase "$(dpkg --print-architecture)" in aarch64) TARGET="aarch64-linux-android" ;; arm) TARGET="armv7-linux-androideabi" ;; i686) TARGET="i686-linux-android" ;; x86_64) TARGET="x86_64-linux-android" ;; esac VERSION=$(curl -sL https://api.github.com/repos/rc-chuah/termux-backup/releases/latest | grep -Po '"tag_name": "\K[^"]*') TAR_VERSION="${VERSION#v}" curl -LO "https://github.com/rc-chuah/termux-backup/releases/download/${VERSION}/termux-backup-${TAR_VERSION}-${TARGET}.tar.gz" tar -xzf "termux-backup-${TAR_VERSION}-${TARGET}.tar.gz" -C "$PREFIX/bin" chmod +x "$PREFIX/bin/termux-backup" rm -f "termux-backup-${TAR_VERSION}-${TARGET}.tar.gz"
termux-backup, and move it to$PREFIX/bin/. - Run the program:
termux-backup
- Install using Cargo:
Or install with latest compatible dependency versions:
cargo install --locked termux-backup
Or install using cargo-binstall:cargo install termux-backup
cargo binstall termux-backup
- Run the program:
termux-backup
- Install dependencies in Termux:
pkg update -y && pkg install git rust -y - Git clone the repository:
git clone https://github.com/rc-chuah/termux-backup
- Change directory:
cd termux-backup - Build the release binary:
cargo build --release
- Install to PATH:
cp target/release/termux-backup $PREFIX/bin/termux-backup && chmod +x $PREFIX/bin/termux-backup
- Run the program:
termux-backup
All release .tar.gz archives include SHA256 checksums and GitHub Artifact Attestations.
- Verify build provenance using GitHub CLI (
pkg install ghin Termux):# Verify .tar.gz archive gh attestation verify termux-backup-<version>-<target>.tar.gz --repo rc-chuah/termux-backup
- Or verify the SHA256 checksum:
# Verify .tar.gz checksum sha256sum -c termux-backup-<version>-<target>.tar.gz.sha256
- Backup only works in a normal Termux session.
- Restore works in both normal and failsafe sessions.
- Backups are 100% non-destructive and preserve shell history files (
.bash_history) intact. - Backups and their
.sha256checksum files are stored at/storage/emulated/0/termux/backups. - When prompted for a backup name, leaving it blank defaults to
termux-YYYYMMDD-HHMMSS.tar.gz(UTC), while custom names automatically append.tar.gzif.tar.gzor.tgzis omitted. - SHA-256 checksum calculation, backup compression, and archive restoration display a live progress bar with percentage,
MB/sspeed, and ETA. - During restore, the archive is automatically verified against its
.sha256checksum file if present before modifying the Termux environment. - During restore, the existing Termux
filesdirectory is cleaned before extracting the backup archive in pure Rust.
- Original bash script by Zongou.
- Rewritten in Rust by RC Chuah-(RaynerSec).
Licensed under the GNU General Public License v3.0.