Skip to content

Instantly share code, notes, and snippets.

@raymondctc
Last active February 14, 2025 19:07
Show Gist options
  • Save raymondctc/9f1d3841e5af573a3be6 to your computer and use it in GitHub Desktop.
Save raymondctc/9f1d3841e5af573a3be6 to your computer and use it in GitHub Desktop.
Batch install apks to multiple connected devices
#!/bin/sh
adb devices | tail -n +2 | cut -sf 1 | xargs -I \{\} -P4 adb -s \{\} install -r $1
@user2user1
Copy link

Don't know if you'll see this or not but I found this it's what I've been looking for but I can't get it to work it comes up and says it dont know what tail -n +2 i know what you said it didn't but I have no idea how to fix it I want to be able to plug three devices into laptop hit run and have them all get installed one app hope you see this thanks

#!/bin/sh
adb devices | tail -n +2 | cut -sf 1 | xargs -I {} -P4 adb -s {} install -r $1

@raymondctc
Copy link
Author

@user2user1
tail -n +2

  • Skips the first line of adb devices output (which is just a header).
  • Since the output of adb devices looks like this:
List of devices attached
emulator-5554   device
emulator-5556   device

Here, the first line is not needed, so tail -n +2 removes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment