1# ADB(1) MAN PAGE 2 3# VERSION 4 51.0.41 6 7# NAME 8 9**adb** 10 CLI Client for ADB (Android Debug Bridge) Server. 11 12# SYNOPSIS 13 14**adb** [*GLOBAL_OPTIONS*] command [*COMMAND_OPTIONS*] 15 16# DESCRIPTION 17 18Connects to the ADB Server via its smart socket interface. Allows sending requests, receives responses and manages lifecycle of the adb server. 19 20Tasks are performed via commands. Some commands are fulfilled directly by the server while others are "forwarded over to the adbd(ADB daemon) running on the device. 21 22# GLOBAL OPTIONS: 23 24**-a** 25 Listen on all network interfaces, not just localhost. 26 27**-d** 28 Use USB device (error if multiple devices connected). 29 30**-e** 31 Use TCP/IP device (error if multiple TCP/IP devices available). 32 33**-s** **SERIAL** 34 Use device with given **SERIAL** (overrides $ANDROID_SERIAL). 35 36**-t** **ID** 37 Use device with given transport **ID**. 38 39**-H** 40 Name of adb server host [default=localhost]. 41 42**-P** **PORT* 43 Smart socket **PORT** of adb server [default=5037]. 44 45**-L** **SOCKET** 46 Listen on given socket for adb server [default=tcp:localhost:5037]. 47 48**\-\-one-device** **SERIAL**|**USB** 49 Server will only connect to one USB device, specified by a **SERIAL** number or **USB** device address (only with 'start-server' or 'server nodaemon'). 50 51**\-\-exit-on-write-error** 52 Exit if stdout is closed. 53 54 55# GENERAL COMMANDS: 56 57devices [**-l**] 58 List connected devices. 59 60**-l** 61 Use long output. 62 63help 64 Show this help message. 65 66version 67 Show version number. 68 69# NETWORKING 70 71connect **HOST**[:**PORT**] 72 Connect to a device via TCP/IP [default **PORT**=5555]. 73 74disconnect [**HOST**[:**PORT**]] 75 Disconnect from given TCP/IP device [default **PORT**=5555], or all. 76 77pair **HOST**[:**PORT**] [**PAIRING_CODE**] 78 Pair with a device for secure TCP/IP communication. 79 80forward **\-\-list** | [**--no-rebind**] **LOCAL_REMOTE** | **\-\-remove** **LOCAL** | **\-\-remove-all** 81 82**\-\-list** 83 List all forward socket connections. 84 85[**--no-rebind**] **LOCAL_REMOTE** 86 Forward socket connection using one of the followings. 87 88 **tcp**:**PORT** (local may be "tcp:0" to pick any open port. 89 **localreserved**:**UNIX_DOMAIN_SOCKET_NAME**. 90 **localfilesystem**:**UNIX_DOMAIN_SOCKET_NAME**. 91 **jdwp**:**PROCESS PID** (remote only). 92 **vsock**:**CID**:**PORT** (remote only). 93 **acceptfd**:**FD** (listen only). 94 **dev**:**DEVICE_NAME**. 95 **dev-raw**:**DEVICE_NAME**. (open device in raw mode)**. 96 97**\-\-remove** **LOCAL** 98 Remove specific forward socket connection. 99 100**\-\-remove-all** 101 Remove all forward socket connections. 102 103reverse **\-\-list** | [**\-\-no-rebind**] **REMOTE** **LOCAL** | **\-\-remove** **REMOTE** | **\-\-remove-all** 104 105**\-\-list** 106 List all reverse socket connections from device. 107 108[**\-\-no-rebind**] **REMOTE** **LOCAL** 109 Reverse socket connection using one of the following. 110 111 tcp:**PORT** (**REMOTE** may be "tcp:0" to pick any open port). 112 localabstract:**UNIX_DOMAIN_SOCKET_NAME**. 113 localreserved:**UNIX_DOMAIN_SOCKET_NAME**. 114 localfilesystem:**UNIX_DOMAIN_SOCKET_NAME**. 115 116**\-\-remove** **REMOTE** 117 Remove specific reverse socket connection. 118 119**\-\-remove-all** 120 Remove all reverse socket connections from device. 121 122mdns **check** | **services** 123 Perform mDNS subcommands. 124 125**check** 126 Check if mdns discovery is available. 127 128**services** 129 List all discovered services. 130 131 132# FILE TRANSFER: 133 134push [**--sync**] [**-z** **ALGORITHM**] [**-Z**] **LOCAL**... **REMOTE** 135 Copy local files/directories to device. 136 137**--sync** 138 Only push files that are newer on the host than the device. 139 140**-n** 141 Dry run, push files to device without storing to the filesystem. 142 143**-z** 144 enable compression with a specified algorithm (any/none/brotli/lz4/zstd). 145 146**-Z** 147 Disable compression. 148 149pull [**-a**] [**-z** **ALGORITHM**] [**-Z**] **REMOTE**... **LOCAL** 150 Copy files/dirs from device 151 152**-a** 153 preserve file timestamp and mode. 154 155**-z** 156 enable compression with a specified algorithm (**any**/**none**/**brotli**/**lz4**/**zstd**) 157 158**-Z** 159 disable compression 160 161sync [**-l**] [**-z** **ALGORITHM**] [**-Z**] [**all**|**data**|**odm**|**oem**|**product**|**system**|**system_ext**|**vendor**] 162 Sync a local build from $ANDROID_PRODUCT_OUT to the device (default all) 163 164**-n** 165 Dry run. Push files to device without storing to the filesystem. 166 167**-l** 168 List files that would be copied, but don't copy them. 169 170**-z** 171Enable compression with a specified algorithm (**any**/**none**/**brotli**/**lz4**/**zstd**) 172 173**-Z** 174Disable compression. 175 176# SHELL: 177 178shell [**-e** **ESCAPE**] [**-n**] [**-Tt**] [**-x**] [**COMMAND**...] 179 Run remote shell command (interactive shell if no command given). 180 181**-e** 182 Choose escape character, or "**none**"; default '**~**'. 183 184**-n** 185 Don't read from stdin. 186 187**-T**: 188 Disable pty allocation. 189 190**-t**: 191 Allocate a pty if on a tty (-tt: force pty allocation). 192 193**-x** 194 Disable remote exit codes and stdout/stderr separation. 195 196emu **COMMAND** 197 Run emulator console **COMMAND** 198 199# APP INSTALLATION 200(see also `adb shell cmd package help`): 201 202install [**-lrtsdg**] [**--instant**] **PACKAGE** 203 Push a single package to the device and install it 204 205install-multiple [**-lrtsdpg**] [**--instant**] **PACKAGE**... 206 Push multiple APKs to the device for a single package and install them 207 208install-multi-package [**-lrtsdpg**] [**--instant**] **PACKAGE**... 209 Push one or more packages to the device and install them atomically 210 211**-r**: 212 Replace existing application. 213 214**-t** 215 Allow test packages. 216 217**-d** 218 Allow version code downgrade (debuggable packages only). 219 220**-p** 221 Partial application install (install-multiple only). 222 223**-g** 224 Grant all runtime permissions. 225 226**\-\-abi** **ABI** 227 Override platform's default ABI. 228 229**\-\-instant** 230 Cause the app to be installed as an ephemeral install app. 231 232**\-\-no-streaming** 233 Always push APK to device and invoke Package Manager as separate steps. 234 235**\-\-streaming** 236 Force streaming APK directly into Package Manager. 237 238**\-\-fastdeploy** 239 Use fast deploy. 240 241**-no-fastdeploy** 242 Prevent use of fast deploy. 243 244**-force-agent** 245 Force update of deployment agent when using fast deploy. 246 247**-date-check-agent** 248 Update deployment agent when local version is newer and using fast deploy. 249 250**\-\-version-check-agent** 251 Update deployment agent when local version has different version code and using fast deploy. 252 253**\-\-local-agent** 254 Locate agent files from local source build (instead of SDK location). See also `adb shell pm help` for more options. 255 256uninstall [**-k**] **APPLICATION_ID** 257 Remove this **APPLICATION_ID** from the device. 258 259**-k** 260 Keep the data and cache directories. 261 262# DEBUGGING: 263 264bugreport [**PATH**] 265 Write bugreport to given PATH [default=bugreport.zip]; if **PATH** is a directory, the bug report is saved in that directory. devices that don't support zipped bug reports output to stdout. 266 267jdwp 268 List pids of processes hosting a JDWP transport. 269 270logcat 271 Show device log (logcat --help for more). 272 273server-status Display server configuration (USB backend, mDNS backend, log location, binary path. See [adb_host.proto](../../proto/adb_host.proto) (AdbServerStatus) for details. 274 275# SECURITY: 276 277disable-verity 278 Disable dm-verity checking on userdebug builds. 279 280enable-verity 281 Re-enable dm-verity checking on userdebug builds. 282 283keygen **FILE** 284 Generate adb public/private key; private key stored in **FILE**. 285 286# SCRIPTING: 287 288wait-for [-**TRANSPORT**] -**STATE**... 289 Wait for device to be in a given state. 290 291 **STATE**: device, recovery, rescue, sideload, bootloader, or disconnect. 292 **TRANSPORT**: **usb**, **local**, or **any** [default=**any**]. 293 294get-state 295 Print offline | bootloader | device. 296 297get-serialno 298 Print **SERIAL_NUMBER**. 299 300get-devpath 301 Print **DEVICE_PATH**. 302 303remount [**-R**] 304 Remount partitions read-write. 305 306**-R** 307 Automatically reboot the device. 308 309reboot [**bootloader**|**recovery**|**sideload**|**sideload-auto-reboot**] 310 Reboot the device; defaults to booting system image but supports **bootloader** and **recovery** too. 311 312**sideload** 313 Reboots into recovery and automatically starts sideload mode. 314 315**sideload-auto-reboot** 316 Same as **sideload** but reboots after sideloading. 317 318 319sideload **OTAPACKAGE** 320 Sideload the given full OTA package **OTAPACKAGE**. 321 322root 323 Restart adbd with root permissions. 324 325unroot 326 Restart adbd without root permissions. 327 328usb 329 Restart adbd listening on USB. 330 331tcpip **PORT** 332 Restart adbd listening on TCP on **PORT**. 333 334# INTERNAL DEBUGGING: 335 336start-server 337 Ensure that there is a server running. 338 339kill-server 340 Kill the server if it is running. 341 342reconnect 343 Close connection from host side to force reconnect. 344 345reconnect device 346 Close connection from device side to force reconnect. 347 348reconnect offline 349 Reset offline/unauthorized devices to force reconnect. 350 351# USB: 352 353Only valid when running with libusb backend. 354 355attach **SERIAL** 356 Attach a detached USB device identified by its **SERIAL** number. 357 358detach **SERIAL** 359 Detach from a USB device identified by its **SERIAL** to allow use by other processes. 360 361 362# Features: 363 364host-features 365 list features supported by adb server. 366 367features 368 list features supported by both adb server and device. 369 370# ENVIRONMENT VARIABLES 371 372$ADB_TRACE 373 Comma (or space) separated list of debug info to log: all,adb,sockets,packets,rwx,usb,sync,sysdeps,transport,jdwp,services,auth,fdevent,shell,incremental, mdns. 374 375$ADB_VENDOR_KEYS 376 Colon-separated list of keys (files or directories). 377 378$ANDROID_SERIAL 379 Serial number to connect to (see -s). 380 381$ANDROID_LOG_TAGS 382 Tags to be used by logcat (see logcat --help). 383 384$ADB_LOCAL_TRANSPORT_MAX_PORT 385 Max emulator scan port (default 5585, 16 emulators). 386 387$ADB_MDNS_AUTO_CONNECT 388 Comma-separated list of mdns services to allow auto-connect (default adb-tls-connect). 389 390$ADB_MDNS_OPENSCREEN 391 The default mDNS-SD backend is Bonjour (mdnsResponder). For machines where Bonjour is not installed, adb can spawn its own, embedded, mDNS-SD back end, openscreen. If set to "1", this env variable forces mDNS backend to openscreen. 392 393$ADB_LIBUSB 394 ADB has its own USB backend implementation but can also employ libusb. use `adb devices -l` (`usb:` prefix is omitted for libusb) or `adb host-features` (look for `libusb` in the output list) to identify which is in use. To override the default for your OS, set ADB_LIBUSB to "1" to enable libusb, or "0" to enable the ADB backend implementation. 395 396# BUGS 397 398See Issue Tracker: [here](https://issuetracker.google.com/issues/new?component=192795&template=1310483). 399 400# AUTHORS 401 402See [OWNERS](../../OWNERS) file in ADB AOSP repo. 403