How to use adb commands with multiple devices for android

How to use adb commands with multiple devices

How to use adb commands with multiple devices

adb can be used for multiple devices attached to the same computer. You can control each connected device using serial number. Serial numbers are fixed for an android device. Even if you connect and disconnect thousands of times, the serial number will be same. For example, I have connected two devices in my computer. Lets run  command “adb devices”. adb commands work exactly same in windows and linux or ubuntu. So, you can run these commands in any platform. adb is an android debug tool. So, you can only use adb to control android devices. Also make sure to enable USB debugging mode in developer option. Now lets run the adb devices command.

C:\Downloads\platform-tools_r30.0.4-windows\platform-tools>adb.exe devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
1765444FG     device
475658GHF     device

You can see the serial numbers of two attached devices. So, now if you want to reboot one of the device, just run the normal adb reboot command with -s as shown below.

Example 1. Reboot one of the devices attached to the PC.

adb -s 1765444FG reboot.

The above command will reboot the particular device with serial number 1765444FG.

Example 2. Turn on airplane mode in one of the two device

adb shell -s 1765444FG settings put global airplane_mode_on 1
adb shell -s 1765444FG am broadcast -a android.intent.action.AIRPLANE_MOD

Click this link to read about adb commands | adb devices | adb device not found | adb push | adb shell.

If you have any doubt regarding adb commands, feel free to write your doubts in comment box. I would be happy to help.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.