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
273
274# SECURITY:
275
276disable-verity
277    Disable dm-verity checking on userdebug builds.
278
279enable-verity
280    Re-enable dm-verity checking on userdebug builds.
281
282keygen **FILE**
283    Generate adb public/private key; private key stored in **FILE**.
284
285# SCRIPTING:
286
287wait-for [-**TRANSPORT**] -**STATE**...
288     Wait for device to be in a given state.
289
290    **STATE**: device, recovery, rescue, sideload, bootloader, or disconnect.
291    **TRANSPORT**: **usb**, **local**, or **any** [default=**any**].
292
293get-state
294    Print offline | bootloader | device.
295
296get-serialno
297    Print **SERIAL_NUMBER**.
298
299get-devpath
300    Print  **DEVICE_PATH**.
301
302remount [**-R**]
303    Remount partitions read-write.
304
305**-R**
306    Automatically reboot the device.
307
308reboot [**bootloader**|**recovery**|**sideload**|**sideload-auto-reboot**]
309    Reboot the device; defaults to booting system image but supports **bootloader** and **recovery** too.
310
311**sideload**
312    Reboots into recovery and automatically starts sideload mode.
313
314**sideload-auto-reboot**
315    Same as **sideload** but reboots after sideloading.
316
317
318sideload **OTAPACKAGE**
319    Sideload the given full OTA package **OTAPACKAGE**.
320
321root
322    Restart adbd with root permissions.
323
324unroot
325    Restart adbd without root permissions.
326
327usb
328    Restart adbd listening on USB.
329
330tcpip **PORT**
331    Restart adbd listening on TCP on **PORT**.
332
333# INTERNAL DEBUGGING:
334
335start-server
336    Ensure that there is a server running.
337
338kill-server
339    Kill the server if it is running.
340
341reconnect
342    Close connection from host side to force reconnect.
343
344reconnect device
345    Close connection from device side to force reconnect.
346
347reconnect offline
348    Reset offline/unauthorized devices to force reconnect.
349
350# USB:
351
352Only valid when running with libusb backend.
353
354attach **SERIAL**
355    Attach a detached USB device identified by its **SERIAL** number.
356
357detach **SERIAL**
358    Detach from a USB device identified by its **SERIAL** to allow use by other processes.
359
360
361# Features:
362
363host-features
364    list features supported by adb server.
365
366features
367    list features supported by both adb server and device.
368
369# ENVIRONMENT VARIABLES
370
371$ADB_TRACE
372    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.
373
374$ADB_VENDOR_KEYS
375    Colon-separated list of keys (files or directories).
376
377$ANDROID_SERIAL
378    Serial number to connect to (see -s).
379
380$ANDROID_LOG_TAGS
381    Tags to be used by logcat (see logcat --help).
382
383$ADB_LOCAL_TRANSPORT_MAX_PORT
384    Max emulator scan port (default 5585, 16 emulators).
385
386$ADB_MDNS_AUTO_CONNECT
387    Comma-separated list of mdns services to allow auto-connect (default adb-tls-connect).
388
389$ADB_MDNS_OPENSCREEN
390    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.
391
392$ADB_LIBUSB
393    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.
394
395# BUGS
396
397See Issue Tracker: [here](https://issuetracker.google.com/issues/new?component=192795&template=1310483).
398
399# AUTHORS
400
401See [OWNERS](../../OWNERS) file in ADB AOSP repo.
402