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 95**\-\-remove** **LOCAL** 96 Remove specific forward socket connection. 97 98**\-\-remove-all** 99 Remove all forward socket connections. 100 101reverse **\-\-list** | [**\-\-no-rebind**] **REMOTE** **LOCAL** | **\-\-remove** **REMOTE** | **\-\-remove-all** 102 103**\-\-list** 104 List all reverse socket connections from device. 105 106[**\-\-no-rebind**] **REMOTE** **LOCAL** 107 Reverse socket connection using one of the following. 108 109 tcp:**PORT** (**REMOTE** may be "tcp:0" to pick any open port). 110 localabstract:**UNIX_DOMAIN_SOCKET_NAME**. 111 localreserved:**UNIX_DOMAIN_SOCKET_NAME**. 112 localfilesystem:**UNIX_DOMAIN_SOCKET_NAME**. 113 114**\-\-remove** **REMOTE** 115 Remove specific reverse socket connection. 116 117**\-\-remove-all** 118 Remove all reverse socket connections from device. 119 120mdns **check** | **services** 121 Perform mDNS subcommands. 122 123**check** 124 Check if mdns discovery is available. 125 126**services** 127 List all discovered services. 128 129 130# FILE TRANSFER: 131 132push [**--sync**] [**-z** **ALGORITHM**] [**-Z**] **LOCAL**... **REMOTE** 133 Copy local files/directories to device. 134 135**--sync** 136 Only push files that are newer on the host than the device. 137 138**-n** 139 Dry run, push files to device without storing to the filesystem. 140 141**-z** 142 enable compression with a specified algorithm (any/none/brotli/lz4/zstd). 143 144**-Z** 145 Disable compression. 146 147pull [**-a**] [**-z** **ALGORITHM**] [**-Z**] **REMOTE**... **LOCAL** 148 Copy files/dirs from device 149 150**-a** 151 preserve file timestamp and mode. 152 153**-z** 154 enable compression with a specified algorithm (**any**/**none**/**brotli**/**lz4**/**zstd**) 155 156**-Z** 157 disable compression 158 159sync [**-l**] [**-z** **ALGORITHM**] [**-Z**] [**all**|**data**|**odm**|**oem**|**product**|**system**|**system_ext**|**vendor**] 160 Sync a local build from $ANDROID_PRODUCT_OUT to the device (default all) 161 162**-n** 163 Dry run. Push files to device without storing to the filesystem. 164 165**-l** 166 List files that would be copied, but don't copy them. 167 168**-z** 169Enable compression with a specified algorithm (**any**/**none**/**brotli**/**lz4**/**zstd**) 170 171**-Z** 172Disable compression. 173 174# SHELL: 175 176shell [**-e** **ESCAPE**] [**-n**] [**-Tt**] [**-x**] [**COMMAND**...] 177 Run remote shell command (interactive shell if no command given). 178 179**-e** 180 Choose escape character, or "**none**"; default '**~**'. 181 182**-n** 183 Don't read from stdin. 184 185**-T**: 186 Disable pty allocation. 187 188**-t**: 189 Allocate a pty if on a tty (-tt: force pty allocation). 190 191**-x** 192 Disable remote exit codes and stdout/stderr separation. 193 194emu **COMMAND** 195 Run emulator console **COMMAND** 196 197# APP INSTALLATION 198(see also `adb shell cmd package help`): 199 200install [**-lrtsdg**] [**--instant**] **PACKAGE** 201 Push a single package to the device and install it 202 203install-multiple [**-lrtsdpg**] [**--instant**] **PACKAGE**... 204 Push multiple APKs to the device for a single package and install them 205 206install-multi-package [**-lrtsdpg**] [**--instant**] **PACKAGE**... 207 Push one or more packages to the device and install them atomically 208 209**-r**: 210 Replace existing application. 211 212**-t** 213 Allow test packages. 214 215**-d** 216 Allow version code downgrade (debuggable packages only). 217 218**-p** 219 Partial application install (install-multiple only). 220 221**-g** 222 Grant all runtime permissions. 223 224**\-\-abi** **ABI** 225 Override platform's default ABI. 226 227**\-\-instant** 228 Cause the app to be installed as an ephemeral install app. 229 230**\-\-no-streaming** 231 Always push APK to device and invoke Package Manager as separate steps. 232 233**\-\-streaming** 234 Force streaming APK directly into Package Manager. 235 236**\-\-fastdeploy** 237 Use fast deploy. 238 239**-no-fastdeploy** 240 Prevent use of fast deploy. 241 242**-force-agent** 243 Force update of deployment agent when using fast deploy. 244 245**-date-check-agent** 246 Update deployment agent when local version is newer and using fast deploy. 247 248**\-\-version-check-agent** 249 Update deployment agent when local version has different version code and using fast deploy. 250 251**\-\-local-agent** 252 Locate agent files from local source build (instead of SDK location). See also `adb shell pm help` for more options. 253 254uninstall [**-k**] **APPLICATION_ID** 255 Remove this **APPLICATION_ID** from the device. 256 257**-k** 258 Keep the data and cache directories. 259 260# DEBUGGING: 261 262bugreport [**PATH**] 263 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. 264 265jdwp 266 List pids of processes hosting a JDWP transport. 267 268logcat 269 Show device log (logcat --help for more). 270 271 272# SECURITY: 273 274disable-verity 275 Disable dm-verity checking on userdebug builds. 276 277enable-verity 278 Re-enable dm-verity checking on userdebug builds. 279 280keygen **FILE** 281 Generate adb public/private key; private key stored in **FILE**. 282 283# SCRIPTING: 284 285wait-for [-**TRANSPORT**] -**STATE**... 286 Wait for device to be in a given state. 287 288 **STATE**: device, recovery, rescue, sideload, bootloader, or disconnect. 289 **TRANSPORT**: **usb**, **local**, or **any** [default=**any**]. 290 291get-state 292 Print offline | bootloader | device. 293 294get-serialno 295 Print **SERIAL_NUMBER**. 296 297get-devpath 298 Print **DEVICE_PATH**. 299 300remount [**-R**] 301 Remount partitions read-write. 302 303**-R** 304 Automatically reboot the device. 305 306reboot [**bootloader**|**recovery**|**sideload**|**sideload-auto-reboot**] 307 Reboot the device; defaults to booting system image but supports **bootloader** and **recovery** too. 308 309**sideload** 310 Reboots into recovery and automatically starts sideload mode. 311 312**sideload-auto-reboot** 313 Same as **sideload** but reboots after sideloading. 314 315 316sideload **OTAPACKAGE** 317 Sideload the given full OTA package **OTAPACKAGE**. 318 319root 320 Restart adbd with root permissions. 321 322unroot 323 Restart adbd without root permissions. 324 325usb 326 Restart adbd listening on USB. 327 328tcpip **PORT** 329 Restart adbd listening on TCP on **PORT**. 330 331# INTERNAL DEBUGGING: 332 333start-server 334 Ensure that there is a server running. 335 336kill-server 337 Kill the server if it is running. 338 339reconnect 340 Close connection from host side to force reconnect. 341 342reconnect device 343 Close connection from device side to force reconnect. 344 345reconnect offline 346 Reset offline/unauthorized devices to force reconnect. 347 348# USB: 349 350Only valid when running with libusb backend. 351 352attach **SERIAL** 353 Attach a detached USB device identified by its **SERIAL** number. 354 355detach **SERIAL** 356 Detach from a USB device identified by its **SERIAL** to allow use by other processes. 357 358 359# ENVIRONMENT VARIABLES 360 361$ADB_TRACE 362 Comma-separated list of debug info to log: all,adb,sockets,packets,rwx,usb,sync,sysdeps,transport,jdwp. 363 364$ADB_VENDOR_KEYS 365 Colon-separated list of keys (files or directories). 366 367$ANDROID_SERIAL 368 Serial number to connect to (see -s). 369 370$ANDROID_LOG_TAGS 371 Tags to be used by logcat (see logcat --help). 372 373$ADB_LOCAL_TRANSPORT_MAX_PORT 374 Max emulator scan port (default 5585, 16 emulators). 375 376$ADB_MDNS_AUTO_CONNECT 377 Comma-separated list of mdns services to allow auto-connect (default adb-tls-connect). 378 379# BUGS 380 381See Issue Tracker: [here](https://issuetracker.google.com/issues/new?component=192795&template=1310483). 382 383# AUTHORS 384 385See [OWNERS](../../OWNERS) file in ADB AOSP repo. 386