How to Backup Android Application Data in Linux

This article will cover a guide on backing up Android application data using a Linux computer. By backing up application data, you can restore it later to revert back to an old state or you can use the backups to restore data after you format or wipe your Android device. Note that this guide doesn’t cover backing up user files like images and videos located in internal or external drives available in your Android device. This guide mainly explains backing up application data that is usually hidden from users and can only be viewed on Android devices having root access.

Install ADB

To backup data of an Android application, you will need to connect your Android device to a Linux PC using a USB cable. Once connected you will need “Android Debug Bridge” or “adb” command line utility to interact with your phone.

To install ADB in Ubuntu, use the command specified below:

$ sudo apt install adb

You can install ADB in other Linux distributions from the package manager. You can also download executable binaries for ADB from here.

Enable USB Debugging on Your Phone

To interact with your Android device using the “adb” command on your Linux PC, you will need to enable USB debugging on your Android device first.

To enable USB debugging, you will have to enable the “Developer options” menu on your Android device. This can be done by going to the “Settings > About phone” menu on your Android device and tapping on “Build number” around seven times. Depending on your Android device, the location of the “Build number” option can be different. You can use the search bar in system settings to find it quickly.

After you tap seven times on “Build number”, a new entry called “Developer options” should be available in the system settings of your Android device. Go to “Developer options” and enable “USB debugging”, as shown in the screenshot below:

Authenticate ADB Connection

Connect your Android device to Linux PC through a USB cable. Run the command below to initiate authorization:

$ adb devices

You should get a prompt similar to this on your Android device:

Click on the “Allow” option to authenticate your Android device. You can also check the “Always allow from this computer” option to automatically authenticate your Android device on subsequent connections.

After a successful connection, you should see some output in the terminal showing the serial number of your Android device.

If you see an “unauthorized” string instead of “device” in front of the serial number, something went wrong and your device could not be authenticated. To retry, unplug the USB cable, reconnect your Android device to your Linux PC and repeat the authentication steps listed above.

Get Package ID

Now that your Android device is connected to your Linux PC and authenticated with ADB, you are ready to take application backup. But to do so, you will first need the package ID for the application you want to backup.

You can find the package ID using two ways. The first method involves visiting the Play Store listing for your desired application. You will find package ID after “id=” characters, as highlighted in yellow below. You can also get link for a listing from the Play Store app itself by searching for the application and using the “share” feature to copy the link to the clipboard.

In the second method, you can use an adb command to get package names and their IDs. Run the command below to do so.

$ adb shell pm list packages -f | awk '{print $NF}' FS=/

You will get some output like this:





The left hand side in each line in the output will give you a hint about the application name, while the right hand side (after “=” symbol) will give you package ID. You can also make use of the “grep” command to quickly find your desired package ID.

$ adb shell pm list packages -f | awk '{print $NF}' FS=/ | grep vlc

Run Backup Command

Now that your Android device is connected to your Linux PC, authenticated to an ADB connection and you have a package ID, you are ready to take application backup. To do so, run a command in the following format:

$ adb backup -apk <package_id>

For instance, to backup VLC player on Android, you will need to run the following command:

$ adb backup -apk org.videolan.vlc

You can remove the “-apk” switch if you don’t want to backup the “.apk” package file for your desired app.

On newer Android versions, you may be asked to encrypt backup using a password. When prompted, enter a password for the backup.

Wait for the backup process to finish. You should now have a “backup.ab” file containing data backup. You can also supply a custom name for the backup file using the “-f” switch.

$ adb backup -f vlc_backup.ab -apk org.videolan.vlc


While the process mentioned above should work with most third party Android applications, certain Android apps, especially pre-installed system apps, do not allow taking backups of application data through the “adb” command. The backup process doesn’t give any warning that backups are disabled in such cases. If the backup file is extremely small (less than 1KB), your application data may not have been backed up correctly as backups may be disabled for it.

Restore the Backup

You can restore a “.ab” backup file on your Android device using the command below:

$ adb restore backup.ab

Replace “backup.ab” name as required. Keep in mind that restoring backups may not work if the application doesn’t support taking backups through ADB in the first place.

Explore Contents of the Backup

You can explore the contents of a “.ab” file using a utility called “Android Backup Extractor”. You can download it from here. Once downloaded, you should have a “abe.jar” file on your system.

To use it in Linux, you will need to have Java installed on your system. You can install Java in Ubuntu using the command below:

$ sudo apt install default-jre

You can install Java in other Linux distributions by searching for the term “OpenJDK runtime” in the package manager.

To extract a “.ab” backup file to a “backup.tar” extractable archive, run a command in the following format:

$ java -jar abe.jar unpack backup.ab backup.tar <password_you_entered_during_backup>

Replace the file names as needed. In the last part of the command, supply the password in plain text. Here is an example of the command:

$ java -jar abe.jar unpack vlc_backup.ab backup.tar 1234

You can now freely explore the “.tar” file and extract the data to browse the backup files.


You can backup application data through the “adb” command as long as the application allows it. It is the most reliable way available today to backup and restore application data in Android, though Google has been imposing some restrictions on data backups with each iteration of a new Android version.

About the author

Nitesh Kumar

I am a freelancer software developer and content writer who loves Linux, open source software and the free software community.