adb-disconnect
Disconnect an Android device over network/USB
TLDR
View documentation for adb disconnect
SYNOPSIS
adb-disconnect [host[:port]]
PARAMETERS
host[:port]
Optional. Specifies the IP address or hostname of the remote Android device or emulator to disconnect from. The port number is optional; if omitted, it defaults to 5555. If no host or port is provided, the command attempts to disconnect from all active TCP/IP connections.
DESCRIPTION
The `adb-disconnect` command is a utility designed to terminate active TCP/IP connections between the Android Debug Bridge (ADB) server and remote Android devices or emulators. It is commonly implemented as a shell script or an alias that wraps the standard `adb disconnect` subcommand.
When a device is connected via TCP/IP using `adb connect`, it establishes a network session with the ADB server running on the host machine. Over time, multiple such connections might accumulate, or a specific connection might become stale or problematic. `adb-disconnect` provides a clean way to sever these network links.
If invoked with a specific host and an optional port (e.g., `adb-disconnect 192.168.1.100:5555`), it targets and terminates only that particular connection. This is invaluable in scenarios where you need to manage multiple network-connected devices or debug network-related issues.
When called without any arguments, `adb-disconnect` performs a global cleanup, attempting to disconnect from all currently active TCP/IP connections that were previously established with `adb connect`. This makes it a quick tool for resetting the ADB server's network-based device list, freeing up resources, or ensuring that only USB-connected devices remain active. It's an essential command for maintaining a clean and efficient ADB environment, especially in complex development or testing setups.
CAVEATS
The command `adb-disconnect` is not a standalone executable provided directly by the Android SDK. Instead, it is typically a convenience shell script, alias, or function created by users or within specific development environments (like Arch Linux's `android-tools` package) that internally executes the `adb disconnect` command. Therefore, its behavior is identical to `adb disconnect`. It only affects TCP/IP connections and does not disconnect USB-connected devices. Furthermore, it does not stop or kill the ADB server daemon itself.
DEFAULT BEHAVIOR
When `adb-disconnect` is invoked without any arguments (i.e., without specifying a `host` or `port`), it attempts to disconnect from all currently active TCP/IP connections that were previously established using the `adb connect` command. This is a powerful feature for quickly cleaning up all network-based ADB sessions, allowing for a fresh start or to ensure that only USB-connected devices are being managed by the ADB server.
HISTORY
The Android Debug Bridge (ADB) has been a fundamental tool for Android developers since the platform's inception, providing a command-line interface for communicating with devices and emulators. The `disconnect` functionality, integral to ADB's networking capabilities, was introduced to manage TCP/IP connections, which became increasingly relevant as Android devices began supporting ADB over Wi-Fi. While the core `adb disconnect` command has been present for a long time as part of the `adb` utility, `adb-disconnect` as a wrapper or alias likely emerged in community-driven distributions or user configurations to provide a more descriptive or convenient command name for this specific action.