Skip to content

Instantly share code, notes, and snippets.

@alibitek
Last active August 29, 2015 13:56
Show Gist options
  • Save alibitek/9299376 to your computer and use it in GitHub Desktop.
Save alibitek/9299376 to your computer and use it in GitHub Desktop.
Copy all system or non-system APKs from an Android device
# Copy all non-system apks
i=0; APK_DIR=$HOME/Downloads/Android_APKs; [ ! -f "$APK_DIR" ] && mkdir -p "$APK_DIR"; for package in $(adb shell pm list packages -f -3 | cut -d'=' -f1 | cut -d ':' -f2); do let i++; echo "$i ~> $package"; adb pull "$package" "$APK_DIR"; done
# List all non system apks
i=0; for package in $(adb shell pm list packages -f -3 | cut -d'=' -f1 | cut -d ':' -f2); do let i++; echo "$i ~> $package"; done
# Copy all system apks
i=0; APK_DIR=$HOME/Downloads/Android_APKs; [ ! -f "$APK_DIR" ] && mkdir -p "$APK_DIR"; for package in $(adb shell pm list packages -f | grep -P "(system/app|system/priv-app)" | cut -d':' -f2 | cut -d'=' -f1); do let i++; echo "$i ~> $package"; adb pull "$package" "$APK_DIR"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment