Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renjieliu/bc002fb0f5f4b606b73c8a0d10a2795f to your computer and use it in GitHub Desktop.
Save renjieliu/bc002fb0f5f4b606b73c8a0d10a2795f to your computer and use it in GitHub Desktop.
Migrate Termux setup from Device A to Device B

Follow below steps to migrate the setup of Termux from Device A to Device B

Step 1. Backup termux on device A and run below command one by one.

  • cd /data/data/com.termux/files
  • tar -zcvf ./termux-backup_20211031.tar.gz home usr
  • mv ./termux-backup_20211031.tar.gz /storage/[Device A ID]/Android/data/com.termux/files/termux-backup_20211031.tar.gz

Step 2. Restore the setup of Termux on Device B.

  • Use a bluetooth keyboard to connect to the device B
  • Open the termux app
  • Grant the storage permission to the MicroSD card with command termux-setup-storage, and click "Allow"
  • Go to the termux root folder with cd /data/data/com.termux/files
  • Check the soft link target location with ls -al ~/storage/external-1 to get the [Device B ID]
  • Copy the backup file to the termux root folder: cp /storage/[Device B ID]/Android/data/com.termux/files/termux-backup_20211031.tar.gz .
  • Override the current home and usr folder with tar -zxvf ./termux-backup.tar.gz home && tar -zxvf termux-backup.tar.gz usr

Restart the Termux and see if all the setup are in place on device B.

Replace any script/soft link using the /storage/[Device A ID] to /storage/[Device B ID]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment