This is an old revision of the document!
Create the backup (whole)
adb backup -apk -noshared -all -system -f ./my-backup.ab
Create a Single-Package backup
# list the package names adb shell pm list packages # Create a WhatsApp backup (for example), where PACKAGE-NAME is "com.whatsapp" adb backup -f yourbackupfile.ab -noapk com.whatsapp
Extract the files/directories of the backup for query or modification
# strip the first 24 bytes (header) and decompress the raw zlib data with "openssl" dd if=yourbackupfile.ab ibs=24 skip=1 | openssl zlib -d > yourbackupfile.tar # extract the archive tar xvf yourbackupfile.tar
More informatión of how to modify/repack and restore an Android ADB Backup on:
https://stackpointer.io/mobile/android-adb-backup-extract-restore-repack/372/
Restore the backup (any)
adb restore ./my-backup.ab