Hello Guys, hope you all enjoy Termux as we can use it for many purposes, but while using some tools we encounter problems and bugs, and due to it we have only option of clearing app data of termux.
A nd due to that, we lose all the tools , plugins and packages that we have installed in termux.
Also Read What is Termux
To overcome this problem,today I tell you a trick which help you to backup all your Termux data and tools in your phone internal storage and you can restore it anytime.
It is also recommended to take back up regularly to remove any kind of error. And before uninstalling or erasing data of Termux you must take backup of it.
Also Read Hacking Android by Android
Need of Backup
We need to backup Termux because:
- Make Termux bug free
- To not loose Termux tool
- To not loose packages
- Protect data from accidental uninstall
- Backup during changing source
- And many others reasons
It is highly recommended to understand what commands listed here do before copy-pasting them.
Misunderstanding the purpose of each step may irrecoverably damage your data, if that happened to you - do not complain so go step by step.
Also Read Advanced Phishing Tool For Termux
Backing up
In this example, a backup of both home and sysroot will be shown. The resulting archive will be stored on your shared storage /sdcard and compressed with gzip
Step 1. Ensure that storage permission is granted:
termux-setup-storage
Also Read 20+ Basic Commands of Termux you must know
Step 2. Go to Termux base directory:
cd /data/data/com.termux/files
Step 3. Backing up files:
tar -zcf /sdcard/termux-backup.tar.gz home usr
Also Read Installing Phishing Server on Termux
Backup should be finished without any error. There shouldn't be any permission denials unless the user abused root permissions. Warnings about sockets are okay.
Warning: never store your backups in Termux private directories. Their paths may look like:
Also Read Enable extra keys in Termux
/sdcard/Android/data/com.termux - private Termux directory on shared storage
/storage/XXXX-XXXX/Android/data/com.termux - private Termux directory on external storage, XXXX-XXXX is the UUID of your micro-sd card.
${HOME}/storage/external-1 - alias for Termux private directory on your micro-sd.
Once you clear Termux data from settings, these directories are erased too.
Restoring
Here will be assumed that you have backed up both home and usr directory into same archive. Please note that all files would be overwritten during the process.
Step 1. Ensure that storage permission is granted:
termux-setup-storage
Step 2. Go to Termux base directory:
cd /data/data/com.termux/files
Step 3. Extract home and usr with overwriting everything and deleting stale files:
tar -zxf /sdcard/termux-backup.tar.gz --recursive-unlink --preserve-permissions
Now close Termux with the exit button from notification or typing exit and press enter and open it again.
Thank you very much
ReplyDeleteI feel Happy to help you.
DeleteConsider reading other articles also.