Skip to content

Android Debug Bridge

Devices

  • List connected devices:

      adb devices -l

Backup & restore

  • Backup your Android settings and apps:

      adb backup -all -f backup.ab
  • Backup your Android settings, apps and shared storage:

      adb backup -shared -all -f backup.ab
  • Backup only non-system apps:

      adb backup -nosystem -all -f backup.ab
  • Backup only specific app (e.g. Kodi):

      adb backup -shared -f backup_kodi.ab org.xbmc.kodi
  • Restore a previous backup:

      adb restore backup.ab
  • Extract backup:

      ( printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 backup.ab ) | tar -xvzf -
  • Backup using TWRP:

      adb backup --twrp

Bootloader

  • Reboot into the bootloader:

      adb reboot bootloader
  • Unlock the bootloader:

      fastboot oem unlock
  • Flash recovery image ‘recovery.img’:

      fastboot flash recovery recovery.img
  • Sideload file ‘custom-rom.zip’:

      adb sideload custom-rom.zip

Users

  • List users on the system:

      adb shell pm list users
  • Create a new user:

      adb shell pm create-user user-name
  • Remove user:

      adb shell pm remove-user user-name
  • Get maximum number of users supported:

      adb shell pm get-max-users

Packages

  • Install an APK:

      adb install path/to/file-name.apk
  • Uninstall a package:

      adb uninstall package-name

Package manager

  • Get the list of installed packages:

      adb shell pm list packages
  • Get the list of user installed packages:

      adb shell pm list packages -3
  • Print the path to the APK of a given package:

      adb shell pm path package-name
  • Install an APK:

      adb shell pm install path/to/file-name.apk
  • Uninstall a package:

      adb shell pm uninstall package-name
  • Delete data associated to a package:

      adb shell pm clear package-name
  • Enable the given package:

      adb shell pm enable package/class
  • Disable the given package:

      adb shell pm disable package/class
  • Enable the given package for specific user:

      adb shell pm enable --user 10 package/class
  • Disable the given package for specific user:

      adb shell pm disable --user 10 package/class
  • Hide the given package:

      adb shell pm hide package/class
  • Unhide the given package:

      adb shell pm unhide package/class

Data

  • Copy a file to the device:

      adb push local-path device-path
  • Copy a file from the device:

      adb pull device-path local-path
  • Sync device to local directory:

      adb sync local-path

Debug

  • View device log:

      adb logcat
  • Print information for bug reports:

      adb bugreport

Misc

  • Record screen on device:

      adb shell screenrecord /path/to/file-name.mp4