How to use adb shell when multiple devices are connected ?

Android adb command for host, provides a command line option if you want to connect to one specific device using serial number, when you have more than 1 mobile/device is connected over USB or if abd is connected over network.

The option for adb is ” -s ” which directs adb command to the device or emulator with the given serial number or qualifier. Overrides ANDROID_SERIAL environment variable.

Check the serial number of the device you want to connect to,

 $ adb devices 
List of devices attached
B2NGAA8831702707	device1
A4NTXY6734562309        device2

Now, lets say if we want to connect to device1, then use below command,

 $ adb -s B2NGAA8831702707 shell 

Above command should connect to first device.

How to compare two files in notepad... x
How to compare two files in notepad++

2 thoughts on “How to use adb shell when multiple devices are connected ?”

Leave a Comment

Sign up to our newsletter!

ADB Commands Android Android Applications Android Build system Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development & Build Development, Debugging and Performance Tools Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia NDK / Middleware / HAL Operating System Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web design and development Website Hosting Wordpress Yocto Embedded Linux