Android Debug Bridge version 1.0.37
- Global options
- General commands
- Networking
- File transfer
- Shell
- App installation
- Backup/restore
- Debugging
- Security
- Scripting
- Internal debugging
- Environment variables
Global options
Listen on all network interfaces, not just localhost
adb -a
Use USB device (error if multiple devices connected)
adb -d
Use emulator (error if multiple emulators running)
adb -e
Use device/emulator with given serial number (overrides $ANDROID_SERIAL)
adb -s SERIAL
Name or path ('angler'/'out/target/product/angler'); Default $ANDROID_PRODUCT_OUT
adb -p PRODUCT
Name of adb server host [default=localhost]
adb -H
Port of adb server [default=5037]
adb -P
Listen on given socket for adb server [default=tcp:localhost:5037]
adb -L SOCKET
General commands
List connected devices (-l for long output)
adb devices [-l]
Show this help message
adb help
Show version num
adb version
Networking
Connect to a device via TCP/IP [default port=5555]
adb connect HOST[:PORT]
Disconnect from given TCP/IP device [default port=5555], or all
adb disconnect [HOST[:PORT]]
List all forward socket connections
adb forward --list
Forward socket connection using:
- tcp:<port> (<local> may be "tcp:0" to pick any open port)
- localabstract:<unix domain socket name>
- localreserved:<unix domain socket name>
- localfilesystem:<unix domain socket name>
- dev:<character device name>
- jdwp:<process pid> (remote only)
adb forward [--no-rebind] LOCAL REMOTE
Remove specific forward socket connection
adb forward --remove LOCAL
Remove all forward socket connections
adb forward --remove-all
Run PPP over USB
adb ppp TTY [PARAMETER...]
List all reverse socket connections from device
adb reverse --list
Reverse socket connection using:
- 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>
adb reverse [--no-rebind] REMOTE LOCAL
Remove specific reverse socket connection
adb reverse --remove REMOTE
Remove all reverse socket connections from device
adb reverse --remove-all
File transfer
Copy local files/directories to device
adb push LOCAL... REMOTE
Copy files/dirs from device
- -a: preserve file timestamp and mode
adb pull [-a] REMOTE... LOCAL
Copy all changed files to device; If DIR is "system", "vendor", "oem", or "data", only sync that partition (default all)
- -l: list but don't copy
adb sync [DIR]
Shell
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: force PTY allocation
- -x: disable remote exit codes and stdout/stderr separation
adb shell [-e ESCAPE] [-n] [-Tt] [-x] [COMMAND...]
Run emulator console command
adb emu COMMAND
App installation
Push package(s) to the device and install them
- -l: forward lock application
- -r: replace existing application
- -t: allow test packages
- -s: install application on sdcard
- -d: allow version code downgrade (debuggable packages only)
- -p: partial application install (install-multiple only)
- -g: grant all runtime permissions
adb install [-lrtsdg] PACKAGE
adb install-multiple [-lrtsdpg] PACKAGE...
Remove this app package from the device
- '-k': keep the data and cache directories
adb uninstall [-k] PACKAGE
Backup/restore
Write an archive of the device's data to FILE [default=backup.adb] package list optional if -all/-shared are supplied
- -apk/-noapk: do/don't back up .apk files (default -noapk)
- -obb/-noobb: do/don't back up .obb files (default -noobb)
- -shared|-noshared: do/don't back up shared storage (default -noshared)
- -all: back up all installed applications
- -system|-nosystem: include system apps in -all (default -system)
adb backup [-f FILE] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|-nosystem] [PACKAGE...]
Restore device contents from FILE
adb restore FILE
Debugging
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.
adb bugreport [PATH]
List pids of processes hosting a JDWP transport
adb jdwp
Show device log (logcat --help for more)
adb logcat
Security
Disable dm-verity checking on userdebug builds
adb disable-verity
Re-enable dm-verity checking on userdebug builds
adb enable-verity
Generate adb public/private key; Private key stored in FILE, public key stored in FILE.pub (existing files overwritten)
adb keygen FILE
Scripting
Wait for device to be in the given state
- State: device, recovery, sideload, or bootloader
- Transport: usb, local, or any [default=any]
adb wait-for[-TRANSPORT]-STATE
Print offline | bootloader | device
adb get-state
Print <serial-number>
adb get-serialno
Print <device-path>
adb get-devpath
Remount /system, /vendor, and /oem partitions read-write
adb remount
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 is the same but reboots after sideloading.
adb reboot [bootloader|recovery|sideload|sideload-auto-reboot]
Sideload the given full OTA package
adb sideload OTAPACKAGE
Restart adbd with root permissions
adb root
Restart adbd without root permissions
adb unroot
Restart adb server listening on USB
adb usb
Restart adb server listening on TCP on PORT
adb tcpip PORT
Internal debugging
Ensure that there is a server running
adb start-server
Kill the server if it is running
adb kill-server
Kick connection from host side to force reconnect
adb reconnect
Kick connection from device side to force reconnect
adb reconnect device
Environment variables
Comma-separated list of debug info to log:
- all,adb,sockets,packets,rwx,usb,sync,sysdeps,transport,jdwp
$ADB_TRACE
Colon-separated list of keys (files or directories)
$ADB_VENDOR_KEYS
Serial number to connect to (see -s)
$ANDROID_SERIAL
Tags to be used by logcat (see logcat --help)")
$ANDROID_LOG_TAGS