adb shell list devices

ADB Shell: List All Connected Devices

By Melissa Williams
AD

When you work with Android devices through a computer, you often need a way to see exactly what is connected and confirm that the system recognizes them. The command adb shell list devices plays a central role in this process, acting as a bridge between your machine and the Android Debug Bridge.

This command provides a straightforward view of all devices and emulators that ADB can see at that moment, which is essential for both everyday testing and complex automation pipelines. Understanding how to use it correctly saves time and prevents frustrating errors when you try to install apps or run scripts.

What adb shell list devices Does

The primary purpose of adb shell list devices is to query the ADB server for currently connected Android targets. It filters the results to show only serial numbers and their connection status, making it easy to verify that a device is ready for commands.

AD
ADB Commands List: The Complete Guide and Handy Cheat Sheet
ADB Commands List: The Complete Guide and Handy Cheat Sheet
the technology abbreviations for different types of devices are shown in red and white letters
the technology abbreviations for different types of devices are shown in red and white letters
the list of different types of electronic devices
the list of different types of electronic devices

Without this quick check, you might send instructions to the wrong device or encounter errors if a phone or emulator is not fully recognized. This simple one line query is therefore a fundamental habit in any Android development workflow.

How to Run the Command

To execute the query, you open a terminal or command prompt on your computer and type adb devices, which is a shorthand for the full adb shell list devices syntax. The ADB tool communicates with the daemon running on the device and returns a list that includes offline, unauthorized, and online states.

many different types of electronic devices and their names
many different types of electronic devices and their names
the technology abbreviations and abbreviations for different types of devices, such as computers
the technology abbreviations and abbreviations for different types of devices, such as computers
Fastboot Commands: All Hidden Commands List - GetWox
Fastboot Commands: All Hidden Commands List - GetWox

Seeing the word unauthorized usually means that the device has not accepted the RSA key prompt on its screen. An online status indicates that communication is fully established and you can proceed with installations or shell interactions.

Interpreting the Output

The output format is simple, with each device on its own line, followed by its state in one of the following forms: device, offline, or unauthorized. A device marked as device is ready to receive commands, while offline suggests a connectivity or authorization issue.

AD

By regularly using this listing mechanism during a session, you can quickly spot unexpected disconnections or multiple devices that might cause ambiguity when you run adb install or similar instructions. This habit reduces mistakes and keeps your debugging process smooth.

the different types of abbreviations used in various languages and their meanings are shown on this poster
the different types of abbreviations used in various languages and their meanings are shown on this poster
an image of various electronic devices that are in the shape of a symbol on a white background
an image of various electronic devices that are in the shape of a symbol on a white background
the sd card module with pinout explanation is shown in this advertiser's manual
the sd card module with pinout explanation is shown in this advertiser's manual
Adryan (Kodi channels for android home screen always ) ......
Adryan (Kodi channels for android home screen always ) ......
ansiee standard device numbers list
ansiee standard device numbers list
the table shows different types of abbreviations for each type of information in this document
the table shows different types of abbreviations for each type of information in this document

Common Use Cases and Scenarios

Developers rely on adb shell list devices before every batch of operations, such as running tests, pushing files, or debugging network issues. Automation scripts depend on it heavily to select the correct serial number and avoid hard coded values that break when the environment changes.

For example, a continuous integration server may start a build by checking that at least one Android device is online, ensuring that no step proceeds silently with missing hardware targets. QA engineers also use the same command to validate that newly flashed builds are detected correctly by the host machine.

AD

Working with Multiple Devices

When several phones, tablets, or emulators are connected, the list becomes longer and more complex. You might see a mix of USB connected devices and TCPIP devices, each with its own unique serial string.

there are many electronic devices that can be found in this info sheet for the internet
there are many electronic devices that can be found in this info sheet for the internet
the back side of a computer keyboard with many different types of buttons
the back side of a computer keyboard with many different types of buttons
an iphone screen showing the names and numbers of various electronic devices, including one for each device
an iphone screen showing the names and numbers of various electronic devices, including one for each device
a list of different types of forms in the form of an information sheet with words on it
a list of different types of forms in the form of an information sheet with words on it
an image of various types of electronic devices and their names on a white background with black lettering
an image of various types of electronic devices and their names on a white background with black lettering
computer accessories are displayed on a poster with the words, computers and other electronic devices
computer accessories are displayed on a poster with the words, computers and other electronic devices
Onn Universal Remote Codes: Program ONB13AV004 for 4 Devices
Onn Universal Remote Codes: Program ONB13AV004 for 4 Devices
ESP32 Overview: What It Is and Why Makers Use It
ESP32 Overview: What It Is and Why Makers Use It
What is Shell Sort?
What is Shell Sort?
an iphone with all the parts labeled
an iphone with all the parts labeled
the reverse shell for windows 7 and 8 is shown in this screenshoter image
the reverse shell for windows 7 and 8 is shown in this screenshoter image
several different types of memory cards and disk disks on a white background with text that reads hard disk, cd - rom, floppy disk,
several different types of memory cards and disk disks on a white background with text that reads hard disk, cd - rom, floppy disk,
an info sheet with different types of words and numbers on the bottom right hand corner
an info sheet with different types of words and numbers on the bottom right hand corner

Using adb -s followed by the specific serial number allows you to target one device without affecting the others. This precision is critical in environments where testers share the same machines or where parallel execution is needed for performance benchmarks.

Scripting and CI Integration

In automated pipelines, the command is often the first step after establishing an SSH session or a local build agent. Scripts parse the output, verify that the expected number of devices appear, and then proceed with deployment or instrumentation tasks.

AD

By combining this query with timeout checks and error handling, teams can build robust workflows that fail fast when a device goes offline unexpectedly. This approach improves reliability and makes it easier to trace issues in complex test matrices.

Troubleshooting Connection Problems

If the list appears empty when you expect devices, the first step is to check physical connections, USB debugging settings, and whether the adb server is already running. Sometimes restarting the adb daemon with adb kill-server and adb start-server clears transient glitches.

Another frequent cause is missing USB drivers on the host machine, especially on Windows systems. Ensuring that the proper manufacturer drivers are installed and that the device is not in file transfer mode usually resolves most recognition issues.

Handling Unauthorized Devices

An unauthorized state means that the device screen is locked and the RSA fingerprint prompt has not been accepted. Simply unlocking the phone and confirming the dialog is enough to move the status to device.

In secure environments, this prompt is a security feature that prevents unauthorized computers from interacting with the phone. Understanding this behavior helps teams set up secure yet functional development and testing setups.

Dealing with Offline Devices

An offline status can indicate a network problem when using wireless ADB, a crashed adb daemon on the device, or a communication mismatch. Running adb disconnect and then reconnecting over TCPIP or USB often brings the device back online.

Keeping an eye on the list during long running test suites helps detect flaky connections early, so you can rerun only the affected modules instead of the entire suite. This targeted approach saves time and reduces noise in test logs.

Best Practices for Using adb shell list devices

Make it a habit to run adb devices or its longer form at the start of any manual or scripted operation. This quick check establishes a known baseline and reduces confusion when something fails unexpectedly.

Combine the listing step with clear logging in your scripts, so that anyone reviewing the output can instantly see which devices were found and which were missing. Good logging turns a simple query into a powerful diagnostic record.

Naming Conventions and Serial Management

If you regularly work with many devices, consider adding consistent naming schemes or aliases in your scripts. That way, adb shell list devices becomes not just a diagnostic tool but also part of a larger device management strategy.

Document which physical port or network address corresponds to which logical name in your team wiki, so new members can quickly understand the layout without trial and error.

Combining with Other ADB Commands

After confirming that devices are present, you can safely chain commands such as adb install, adb logcat, or adb shell input. The listing step ensures that these subsequent instructions have a valid target.

Using adb shell list devices together with tools like grep or awk in the terminal allows you to filter the output programmatically, which is invaluable for complex multi device test frameworks.

Mastering the use of adb shell list devices transforms how you interact with Android hardware, giving you confidence that the right device is always selected before the next command runs. Treat it as the foundation of a stable and scalable mobile development workflow.

As your projects grow in complexity, this simple query will remain a vital checkpoint that keeps your processes organized, predictable, and resilient to environmental changes.

AD