File: adb.1.md

package info (click to toggle)
android-platform-tools 35.0.2-1~exp6
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 211,716 kB
  • sloc: cpp: 995,749; java: 290,495; ansic: 145,647; xml: 58,531; python: 39,608; sh: 14,500; javascript: 5,198; asm: 4,866; makefile: 3,115; yacc: 769; awk: 368; ruby: 183; sql: 140; perl: 88; lex: 67
file content (402 lines) | stat: -rw-r--r-- 13,168 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# ADB(1) MAN PAGE

# VERSION

1.0.41

# NAME

**adb**
    CLI Client for ADB (Android Debug Bridge) Server.

# SYNOPSIS

**adb** [*GLOBAL_OPTIONS*] command [*COMMAND_OPTIONS*]

# DESCRIPTION

Connects to the ADB Server via its smart socket interface. Allows sending requests, receives responses and manages lifecycle of the adb server.

Tasks 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.

# GLOBAL OPTIONS:

**-a**
    Listen on all network interfaces, not just localhost.

**-d**
    Use USB device (error if multiple devices connected).

**-e**
    Use TCP/IP device (error if multiple TCP/IP devices available).

**-s** **SERIAL**
    Use device with given **SERIAL** (overrides $ANDROID_SERIAL).

**-t** **ID**
    Use device with given transport **ID**.

**-H**
    Name of adb server host [default=localhost].

**-P** **PORT*
    Smart socket **PORT** of adb server [default=5037].

**-L** **SOCKET**
    Listen on given socket for adb server [default=tcp:localhost:5037].

**\-\-one-device** **SERIAL**|**USB**
    Server will only connect to one USB device, specified by a **SERIAL** number or **USB** device address (only with 'start-server' or 'server nodaemon').

**\-\-exit-on-write-error**
    Exit if stdout is closed.


# GENERAL COMMANDS:

devices [**-l**]
    List connected devices.

**-l**
    Use long output.

help
    Show this help message.

version
    Show version number.

# NETWORKING

connect **HOST**[:**PORT**]
    Connect to a device via TCP/IP [default **PORT**=5555].

disconnect [**HOST**[:**PORT**]]
    Disconnect from given TCP/IP device [default **PORT**=5555], or all.

pair **HOST**[:**PORT**] [**PAIRING_CODE**]
    Pair with a device for secure TCP/IP communication.

forward **\-\-list** | [**--no-rebind**] **LOCAL_REMOTE** | **\-\-remove** **LOCAL** | **\-\-remove-all**

**\-\-list**
    List all forward socket connections.

[**--no-rebind**] **LOCAL_REMOTE**
    Forward socket connection using one of the followings.

    **tcp**:**PORT** (local may be "tcp:0" to pick any open port.
    **localreserved**:**UNIX_DOMAIN_SOCKET_NAME**.
    **localfilesystem**:**UNIX_DOMAIN_SOCKET_NAME**.
    **jdwp**:**PROCESS PID** (remote only).
    **vsock**:**CID**:**PORT** (remote only).
    **acceptfd**:**FD** (listen only).
    **dev**:**DEVICE_NAME**.
    **dev-raw**:**DEVICE_NAME**. (open device in raw mode)**.

**\-\-remove** **LOCAL**
    Remove specific forward socket connection.

**\-\-remove-all**
    Remove all forward socket connections.

reverse **\-\-list** | [**\-\-no-rebind**] **REMOTE** **LOCAL** | **\-\-remove** **REMOTE** | **\-\-remove-all**

**\-\-list**
    List all reverse socket connections from device.

[**\-\-no-rebind**] **REMOTE** **LOCAL**
    Reverse socket connection using one of the following.

    tcp:**PORT** (**REMOTE** may be "tcp:0" to pick any open port).
    localabstract:**UNIX_DOMAIN_SOCKET_NAME**.
    localreserved:**UNIX_DOMAIN_SOCKET_NAME**.
    localfilesystem:**UNIX_DOMAIN_SOCKET_NAME**.

**\-\-remove** **REMOTE**
    Remove specific reverse socket connection.

**\-\-remove-all**
    Remove all reverse socket connections from device.

mdns **check** | **services**
    Perform mDNS subcommands.

**check**
    Check if mdns discovery is available.

**services**
    List all discovered services.


# FILE TRANSFER:

push [**--sync**] [**-z** **ALGORITHM**] [**-Z**] **LOCAL**... **REMOTE**
    Copy local files/directories to device.

**--sync**
    Only push files that are newer on the host than the device.

**-n**
    Dry run, push files to device without storing to the filesystem.

**-z**
    enable compression with a specified algorithm (any/none/brotli/lz4/zstd).

**-Z**
    Disable compression.

pull [**-a**] [**-z** **ALGORITHM**] [**-Z**] **REMOTE**... **LOCAL**
    Copy files/dirs from device

**-a**
    preserve file timestamp and mode.

**-z**
    enable compression with a specified algorithm (**any**/**none**/**brotli**/**lz4**/**zstd**)

**-Z**
    disable compression

sync [**-l**] [**-z** **ALGORITHM**] [**-Z**] [**all**|**data**|**odm**|**oem**|**product**|**system**|**system_ext**|**vendor**]
    Sync a local build from $ANDROID_PRODUCT_OUT to the device (default all)

**-n**
    Dry run. Push files to device without storing to the filesystem.

**-l**
    List files that would be copied, but don't copy them.

**-z**
Enable compression with a specified algorithm (**any**/**none**/**brotli**/**lz4**/**zstd**)

**-Z**
Disable compression.

# SHELL:

shell [**-e** **ESCAPE**] [**-n**] [**-Tt**] [**-x**] [**COMMAND**...]
    Run remote shell command (interactive shell if no command given).

**-e**
    Choose escape character, or "**none**"; default '**~**'.

**-n**
    Don't read from stdin.

**-T**:
    Disable pty allocation.

**-t**:
    Allocate a pty if on a tty (-tt: force pty allocation).

**-x**
    Disable remote exit codes and stdout/stderr separation.

emu **COMMAND**
    Run emulator console **COMMAND**

# APP INSTALLATION
(see also `adb shell cmd package help`):

install [**-lrtsdg**] [**--instant**] **PACKAGE**
    Push a single package to the device and install it

install-multiple [**-lrtsdpg**] [**--instant**] **PACKAGE**...
    Push multiple APKs to the device for a single package and install them

install-multi-package [**-lrtsdpg**] [**--instant**] **PACKAGE**...
    Push one or more packages to the device and install them atomically

**-r**:
    Replace existing application.

**-t**
    Allow test packages.

**-d**
    Allow version code downgrade (debuggable packages only).

**-p**
    Partial application install (install-multiple only).

**-g**
    Grant all runtime permissions.

**\-\-abi** **ABI**
    Override platform's default ABI.

**\-\-instant**
    Cause the app to be installed as an ephemeral install app.

**\-\-no-streaming**
    Always push APK to device and invoke Package Manager as separate steps.

**\-\-streaming**
    Force streaming APK directly into Package Manager.

**\-\-fastdeploy**
    Use fast deploy.

**-no-fastdeploy**
    Prevent use of fast deploy.

**-force-agent**
    Force update of deployment agent when using fast deploy.

**-date-check-agent**
    Update deployment agent when local version is newer and using fast deploy.

**\-\-version-check-agent**
    Update deployment agent when local version has different version code and using fast deploy.

**\-\-local-agent**
    Locate agent files from local source build (instead of SDK location). See also `adb shell pm help` for more options.

uninstall [**-k**] **APPLICATION_ID**
    Remove this **APPLICATION_ID** from the device.

**-k**
    Keep the data and cache directories.

# DEBUGGING:

bugreport [**PATH**]
    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.

jdwp
    List pids of processes hosting a JDWP transport.

logcat
    Show device log (logcat --help for more).

server-status Display server configuration (USB backend, mDNS backend, log location, binary path. See [adb_host.proto](../../proto/adb_host.proto) (AdbServerStatus) for details.

# SECURITY:

disable-verity
    Disable dm-verity checking on userdebug builds.

enable-verity
    Re-enable dm-verity checking on userdebug builds.

keygen **FILE**
    Generate adb public/private key; private key stored in **FILE**.

# SCRIPTING:

wait-for [-**TRANSPORT**] -**STATE**...
     Wait for device to be in a given state.

    **STATE**: device, recovery, rescue, sideload, bootloader, or disconnect.
    **TRANSPORT**: **usb**, **local**, or **any** [default=**any**].

get-state
    Print offline | bootloader | device.

get-serialno
    Print **SERIAL_NUMBER**.

get-devpath
    Print  **DEVICE_PATH**.

remount [**-R**]
    Remount partitions read-write.

**-R**
    Automatically reboot the device.

reboot [**bootloader**|**recovery**|**sideload**|**sideload-auto-reboot**]
    Reboot the device; defaults to booting system image but supports **bootloader** and **recovery** too.

**sideload**
    Reboots into recovery and automatically starts sideload mode.

**sideload-auto-reboot**
    Same as **sideload** but reboots after sideloading.


sideload **OTAPACKAGE**
    Sideload the given full OTA package **OTAPACKAGE**.

root
    Restart adbd with root permissions.

unroot
    Restart adbd without root permissions.

usb
    Restart adbd listening on USB.

tcpip **PORT**
    Restart adbd listening on TCP on **PORT**.

# INTERNAL DEBUGGING:

start-server
    Ensure that there is a server running.

kill-server
    Kill the server if it is running.

reconnect
    Close connection from host side to force reconnect.

reconnect device
    Close connection from device side to force reconnect.

reconnect offline
    Reset offline/unauthorized devices to force reconnect.

# USB:

Only valid when running with libusb backend.

attach **SERIAL**
    Attach a detached USB device identified by its **SERIAL** number.

detach **SERIAL**
    Detach from a USB device identified by its **SERIAL** to allow use by other processes.


# Features:

host-features  
    list features supported by adb server.

features  
    list features supported by both adb server and device.

# ENVIRONMENT VARIABLES

$ADB_TRACE
    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.

$ADB_VENDOR_KEYS
    Colon-separated list of keys (files or directories).

$ANDROID_SERIAL
    Serial number to connect to (see -s).

$ANDROID_LOG_TAGS
    Tags to be used by logcat (see logcat --help).

$ADB_LOCAL_TRANSPORT_MAX_PORT
    Max emulator scan port (default 5585, 16 emulators).

$ADB_MDNS_AUTO_CONNECT
    Comma-separated list of mdns services to allow auto-connect (default adb-tls-connect).

$ADB_MDNS_OPENSCREEN
    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.

$ADB_LIBUSB
    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.

# BUGS

See Issue Tracker: [here](https://issuetracker.google.com/issues/new?component=192795&template=1310483).

# AUTHORS

See [OWNERS](../../OWNERS) file in ADB AOSP repo.