-a - directs adb to listen on all interfaces for a connection
-d - directs command to the only connected USB device
returns an error if more than one USB device is present.
-e - directs command to the only running emulator.
returns an error if more than one emulator is running.
-s <specific device> - directs command to the device or emulator with the given
serial number or qualifier. Overrides ANDROID_SERIAL
environment variable.
-p <product name or path> - simple product name like 'sooner', or
a relative/absolute path to a product
out directory like 'out/target/product/sooner'.
If -p is not specified, the ANDROID_PRODUCT_OUT
environment variable is used, which must
be an absolute path.
-H - Name of adb server host (default: localhost)
-P - Port of adb server (default: 5037)
devices [-l] - list all connected devices
('-l' will also list device qualifiers)
connect <host>[:<port>] - connect to a device via TCP/IP
Port 5555 is used by default if no port number is specified.
disconnect [<host>[:<port>]] - disconnect from a TCP/IP device.
Port 5555 is used by default if no port number is specified.
Using this command with no additional arguments
will disconnect from all connected TCP/IP devices.
device commands:
adb push <local> <remote> - copy file/dir to device
adb pull <remote> [<local>] - copy file/dir from device
adb sync [ <directory> ] - copy host->device only if changed
(-l means list but don't copy)
(see 'adb help all')
adb shell - run remote shell interactively
adb shell <command> - run remote shell command
adb emu <command> - run emulator console command
adb logcat [ <filter-spec> ] - View device log
adb forward --list - list all forward socket connections.
the format is a list of lines with the following format:
<serial> " " <local> " " <remote> "\n"
adb forward <local> <remote> - forward socket connections
forward specs are one of:
tcp:<port>
localabstract:<unix domain socket name>
16 :10 :42 localreserved:<unix domain socket name>
16 :10 :42 localfilesystem:<unix domain socket name>
16 :10 :42 dev:<character device name>
16 :10 :42 jdwp:<process pid> (remote only)
16 :10 :42 adb forward --no-rebind <local> <remote>
16 :10 :42 - same as 'adb forward <local> <remote>' but fails
16 :10 :42 if <local> is already forwarded
16 :10 :42 adb forward --remove <local> - remove a specific forward socket connection
16 :10 :42 adb forward --remove-all - remove all forward socket connections
16 :10 :42 adb jdwp - list PIDs of processes hosting a JDWP transport
16 :10 :42 adb install [-l] [-r] [-s] [--algo <algorithm name> --key <hex-encoded key> --iv <hex-encoded iv>] <file>
16 :10 :42 - push this package file to the device and install it
16 :10 :42 ('-l' means forward-lock the app)
16 :10 :42 ('-r' means reinstall the app, keeping its data)
16 :10 :42 ('-s' means install on SD card instead of internal storage)
16 :10 :42 ('--algo', '--key', and '--iv' mean the file is encrypted already)
16 :10 :42 adb uninstall [-k] <package> - remove this app package from the device
16 :10 :42 ('-k' means keep the data and cache directories)
16 :10 :42 adb bugreport - return all information from the device
16 :10 :42 that should be included in a bug report.
16 :10 :42
16 :10 :42 adb backup [-f <file>] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|-nosystem] [<packages...>]
16 :10 :42 - write an archive of the device's data to <file>.
16 :10 :42 If no -f option is supplied then the data is written
16 :10 :42 to "backup.ab" in the current directory.
16 :10 :42 (-apk|-noapk enable/disable backup of the .apks themselves
16 :10 :42 in the archive; the default is noapk.)
16 :10 :42 (-obb|-noobb enable/disable backup of any installed apk expansion
16 :10 :42 (aka .obb) files associated with each application; the default
16 :10 :42 is noobb.)
16 :10 :42 (-shared|-noshared enable/disable backup of the device's
16 :10 :42 shared storage / SD card contents; the default is noshared.)
16 :10 :42 (-all means to back up all installed applications)
16 :10 :42 (-system|-nosystem toggles whether -all automatically includes
16 :10 :42 system applications; the default is to include system apps)
16 :10 :42 (<packages...> is the list of applications to be backed up. If
16 :10 :42 the -all or -shared flags are passed, then the package
16 :10 :42 list is optional. Applications explicitly given on the
16 :10 :42 command line will be included even if -nosystem would
16 :10 :42 ordinarily cause them to be omitted.)
16 :10 :42
16 :10 :42 adb restore <file> - restore device contents from the <file> backup archive
16 :10 :42
16 :10 :42 adb help - show this help message
16 :10 :42 adb version - show version num
16 :10 :42
16 :10 :42scripting:
16 :10 :42 adb wait-for-device - block until device is online
16 :10 :42 adb start-server - ensure that there is a server running
16 :10 :42 adb kill-server - kill the server if it is running
16 :10 :42 adb get-state - prints: offline | bootloader | device
16 :10 :42 adb get-serialno - prints: <serial-number>
16 :10 :42 adb get-devpath - prints: <device-path>
16 :10 :42 adb status-window - continuously print device status for a specified device
16 :10 :42 adb remount - remounts the /system partition on the device read-write
16 :10 :42 adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program
16 :10 :42 adb reboot-bootloader - reboots the device into the bootloader
16 :10 :42 adb root - restarts the adbd daemon with root permissions
16 :10 :42 adb usb - restarts the adbd daemon listening on USB
16 :10 :42 adb tcpip <port> - restarts the adbd daemon listening on TCP on the specified port
16 :10 :42networking:
16 :10 :42 adb ppp <tty> [parameters] - Run PPP over USB.
16 :10 :42 Note: you should not automatically start a PPP connection.
16 :10 :42 <tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
16 :10 :42 [parameters] - Eg. defaultroute debug dump local notty usepeerdns
16 :10 :42
16 :10 :42adb sync notes: adb sync [ <directory> ]
16 :10 :42 <localdir> can be interpreted in several ways:
16 :10 :42
16 :10 :42 - If <directory> is not specified, both /system and /data partitions will be updated.
16 :10 :42
16 :10 :42 - If it is "system" or "data", only the corresponding partition
16 :10 :42 is updated.
16 :10 :42
16 :10 :42environmental variables:
16 :10 :42 ADB_TRACE - Print debug information. A comma separated list of the following values
16 :10 :42 1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
16 :10 :42 ANDROID_SERIAL - The serial number to connect to. -s takes priority over this if given.
16 :10 :42 ANDROID_LOG_TAGS - When used with the logcat option, only these debug tags are printed.
-d - directs command to the only connected USB device
returns an error if more than one USB device is present.
-e - directs command to the only running emulator.
returns an error if more than one emulator is running.
-s <specific device> - directs command to the device or emulator with the given
serial number or qualifier. Overrides ANDROID_SERIAL
environment variable.
-p <product name or path> - simple product name like 'sooner', or
a relative/absolute path to a product
out directory like 'out/target/product/sooner'.
If -p is not specified, the ANDROID_PRODUCT_OUT
environment variable is used, which must
be an absolute path.
-H - Name of adb server host (default: localhost)
-P - Port of adb server (default: 5037)
devices [-l] - list all connected devices
('-l' will also list device qualifiers)
connect <host>[:<port>] - connect to a device via TCP/IP
Port 5555 is used by default if no port number is specified.
disconnect [<host>[:<port>]] - disconnect from a TCP/IP device.
Port 5555 is used by default if no port number is specified.
Using this command with no additional arguments
will disconnect from all connected TCP/IP devices.
device commands:
adb push <local> <remote> - copy file/dir to device
adb pull <remote> [<local>] - copy file/dir from device
adb sync [ <directory> ] - copy host->device only if changed
(-l means list but don't copy)
(see 'adb help all')
adb shell - run remote shell interactively
adb shell <command> - run remote shell command
adb emu <command> - run emulator console command
adb logcat [ <filter-spec> ] - View device log
adb forward --list - list all forward socket connections.
the format is a list of lines with the following format:
<serial> " " <local> " " <remote> "\n"
adb forward <local> <remote> - forward socket connections
forward specs are one of:
tcp:<port>
localabstract:<unix domain socket name>
16 :10 :42 localreserved:<unix domain socket name>
16 :10 :42 localfilesystem:<unix domain socket name>
16 :10 :42 dev:<character device name>
16 :10 :42 jdwp:<process pid> (remote only)
16 :10 :42 adb forward --no-rebind <local> <remote>
16 :10 :42 - same as 'adb forward <local> <remote>' but fails
16 :10 :42 if <local> is already forwarded
16 :10 :42 adb forward --remove <local> - remove a specific forward socket connection
16 :10 :42 adb forward --remove-all - remove all forward socket connections
16 :10 :42 adb jdwp - list PIDs of processes hosting a JDWP transport
16 :10 :42 adb install [-l] [-r] [-s] [--algo <algorithm name> --key <hex-encoded key> --iv <hex-encoded iv>] <file>
16 :10 :42 - push this package file to the device and install it
16 :10 :42 ('-l' means forward-lock the app)
16 :10 :42 ('-r' means reinstall the app, keeping its data)
16 :10 :42 ('-s' means install on SD card instead of internal storage)
16 :10 :42 ('--algo', '--key', and '--iv' mean the file is encrypted already)
16 :10 :42 adb uninstall [-k] <package> - remove this app package from the device
16 :10 :42 ('-k' means keep the data and cache directories)
16 :10 :42 adb bugreport - return all information from the device
16 :10 :42 that should be included in a bug report.
16 :10 :42
16 :10 :42 adb backup [-f <file>] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|-nosystem] [<packages...>]
16 :10 :42 - write an archive of the device's data to <file>.
16 :10 :42 If no -f option is supplied then the data is written
16 :10 :42 to "backup.ab" in the current directory.
16 :10 :42 (-apk|-noapk enable/disable backup of the .apks themselves
16 :10 :42 in the archive; the default is noapk.)
16 :10 :42 (-obb|-noobb enable/disable backup of any installed apk expansion
16 :10 :42 (aka .obb) files associated with each application; the default
16 :10 :42 is noobb.)
16 :10 :42 (-shared|-noshared enable/disable backup of the device's
16 :10 :42 shared storage / SD card contents; the default is noshared.)
16 :10 :42 (-all means to back up all installed applications)
16 :10 :42 (-system|-nosystem toggles whether -all automatically includes
16 :10 :42 system applications; the default is to include system apps)
16 :10 :42 (<packages...> is the list of applications to be backed up. If
16 :10 :42 the -all or -shared flags are passed, then the package
16 :10 :42 list is optional. Applications explicitly given on the
16 :10 :42 command line will be included even if -nosystem would
16 :10 :42 ordinarily cause them to be omitted.)
16 :10 :42
16 :10 :42 adb restore <file> - restore device contents from the <file> backup archive
16 :10 :42
16 :10 :42 adb help - show this help message
16 :10 :42 adb version - show version num
16 :10 :42
16 :10 :42scripting:
16 :10 :42 adb wait-for-device - block until device is online
16 :10 :42 adb start-server - ensure that there is a server running
16 :10 :42 adb kill-server - kill the server if it is running
16 :10 :42 adb get-state - prints: offline | bootloader | device
16 :10 :42 adb get-serialno - prints: <serial-number>
16 :10 :42 adb get-devpath - prints: <device-path>
16 :10 :42 adb status-window - continuously print device status for a specified device
16 :10 :42 adb remount - remounts the /system partition on the device read-write
16 :10 :42 adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program
16 :10 :42 adb reboot-bootloader - reboots the device into the bootloader
16 :10 :42 adb root - restarts the adbd daemon with root permissions
16 :10 :42 adb usb - restarts the adbd daemon listening on USB
16 :10 :42 adb tcpip <port> - restarts the adbd daemon listening on TCP on the specified port
16 :10 :42networking:
16 :10 :42 adb ppp <tty> [parameters] - Run PPP over USB.
16 :10 :42 Note: you should not automatically start a PPP connection.
16 :10 :42 <tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
16 :10 :42 [parameters] - Eg. defaultroute debug dump local notty usepeerdns
16 :10 :42
16 :10 :42adb sync notes: adb sync [ <directory> ]
16 :10 :42 <localdir> can be interpreted in several ways:
16 :10 :42
16 :10 :42 - If <directory> is not specified, both /system and /data partitions will be updated.
16 :10 :42
16 :10 :42 - If it is "system" or "data", only the corresponding partition
16 :10 :42 is updated.
16 :10 :42
16 :10 :42environmental variables:
16 :10 :42 ADB_TRACE - Print debug information. A comma separated list of the following values
16 :10 :42 1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
16 :10 :42 ANDROID_SERIAL - The serial number to connect to. -s takes priority over this if given.
16 :10 :42 ANDROID_LOG_TAGS - When used with the logcat option, only these debug tags are printed.