How to Back Up Your Android Data with ADB on Ubuntu

Backing up app data, text messages and the like in Android can be incredibly tedious, and sometimes costly too. Many apps on the Play Store promise to back up your data but are hit and miss or cost an arm and a leg. Did you know that there’s a better way to do this and that it can all be done on your computer?

Android comes with a set of development tools. There are many, but the main item of interest is known as ADB (or Android Debug Bridge). It allows a user to gain direct command-line access to any Android device. With this tool anything is possible – including backing up an entire Android device! Here’s how to do it on Ubuntu.

Note: this tutorial is done with a focus on Ubuntu Linux. However, ADB is available on Windows and macOS, and the backup process can be on those platforms as well. Download for windows and Mac.

Installing ADB and Enabling USB Debugging

Open a terminal window and enter this command to install the ADB tool that will interact with Android.


With the ADB tool installed on the system, debugging will need to be enabled inside of Android. Start by opening the Settings area of Android. Scroll all the way to the bottom to find “About Phone” and select it. This opens a “Phone status” page. On this page scroll to the bottom again, find “Build number’ and tap on it seven times. This will enable Developer Mode.


To get to Developer Settings, press the Back button on the device to go back a page. A new option in settings will appear: “Developer options.” Tap on it to enter the developer settings area. Scroll through till you see “Android debugging” (or some variation of it), and tap it to enable the setting.

Backing Up

Creating a backup with ADB is as simple as running one command. First, take the USB cable that corresponds with the Android device, and plug it into the PC. Then, go to a terminal and enter the following:

This will start the Android Debugging Bridge server. With this command running, quickly unlock the Android device, as ADB will force a confirmation window that must be accepted to continue.


To start the backup process, go to the terminal and enter this backup command. It’ll take text messages and other bits of app data, and store it into an encrypted file.


Running the backup command will prompt the user to look at Android and set a password for the file before Android will run the backup procedure. Enter a strong, memorable password. Then, select the “back up my data” button. The backup may take some time, but when it is finished, a file named “backup-file.ab” will be in “/home/username/.”


To restore the backup, enable the ADB server (like mentioned above) and run this command to restore the data.


Once again, go to Android, as ADB will prompt the user to enter a password. This time, instead of creating a password, all that is required is entering the one created from earlier. After that select “restore my data,” and the restoration process will begin. Be patient, as this may take a bit of time.


Not many Android users know this, but ADB is incredibly powerful. It can be used for more than gaining root access on a device. In fact, there are so many things that can be done with this tool, it’d take more than one article to cover all of it!

What tricks do you know with ADB? Let us know below!

Derrik Diener Derrik Diener

Derrik Diener is a freelance technology blogger.


  1. This is great information. Will any of this work with IOS? or am I S O L when it comes to backing up an iPhone in Linux? And also is this same info also good on Linux Mint?

  2. I’ve rooted my xt1562 on Debian9 – don’t know why most tutorials say U need Winblows.
    Run adb shell – it’s like connecting with putty to ssh service on server

  3. You need to install libimobiledevice & libimobiledevice-utils to backup & restore an iOS device. Latest versions works with iOS 10.2.x.

  4. In Manjaro and Arch adb is inside android-tools package from official repo, can be installed with:

    sudo pacman -S android-tools

  5. When I run in a terminal adb start-server, the Vysor app is installed and I can’t do backup. Anyone with the same problem?

  6. Hey Derrik,

    i followed the instructions and everything worked fine. But the size of the backup makes me wonder.
    My Samsung s7 (Android 7.0) tells me that i have got 26,7 GB in use. 12 GB of that is videos.

    How can it be that the backup is only 1.5GB?

    Thanks in advance!

  7. I have a MotoX 2nd Gen an run Linux Ubuntu on my PC.
    I have installed ADB on my PC Linux side and enabled debugging on the Android side.

    In the past I was able to use Helium to backup but now that as well as trying to backup using a terminal window: adb backup -apk -shared -all -f backup-file.adb

    My phone unmounts itself after only a few files have backed up. This same thing happens using Helium as well as trying to backup from the command line.

    Any ideas on how to fix this?? I have tried using different cables too.

  8. This command didn’t work for me :

    adb backup -apk -shared -all -f backup-file.adb

    Instead I had to put single quotes around the parameters. I found this solution here:

Comments are closed.