ADB Command Cheat Sheet
The Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.
Basic Services
| Command | Description |
|---|---|
adb devices |
List connected devices |
adb devices -l |
List connected devices with attributes |
| — | — |
adb root |
Restart adbd with root permissions |
adb start-server |
Start the adb server |
adb kill-server |
Kill the adb server |
adb remount |
Remount file systems with read/write access |
adb reboot |
Reboot the device |
adb reboot bootloader |
Reboot the device into bootloader mode |
adb disable-verity |
Disable dm-verity checking |
You can specify wait-for-device after adb to ensure that the command will run after the device is connected.
-s can be used to send commands to a specific device when multiple devices are connected.
Examples
$ adb wait-for-device devices
List of devices attached
somedevice-1234 device
someotherdevice-1234 device$ adb -s somedevice-1234 rootLog Output
| Command | Description |
|---|---|
adb logcat |
Start printing log messages to stdout |
adb logcat -g |
Show current log buffer size |
adb logcat -G <size> |
Set the buffer size (K or M) |
adb logcat -c |
Clear the log buffer |
adb logcat *:V |
Enable all log messages (verbose) |
adb logcat -f <filename> |
Dump logs to a specified file |
Examples
$ adb logcat -G 16M
$ adb logcat *:V > output.logFile Management
| Command | Description |
|---|---|
adb push <local> <remote> |
Copy local files to the remote device |
adb pull <remote> <local> |
Copy remote device files to local |
Examples
$ echo "This is a test" > test.txt
$ adb push test.txt /sdcard/test.txt
$ adb pull /sdcard/test.txt pulledTest.txtRemote Scripting
| Command | Description |
|---|---|
adb shell <command> |
Run specified command on the device (most Unix commands work here) |
adb shell wm size |
Display the current screen resolution |
adb shell wm size WxH |
Set the resolution to WxH |
adb shell pm list packages |
List all installed packages |
adb shell pm list packages -3 |
List all installed third-party packages |
adb shell monkey -p app.package.name |
Start a specified package (Monkey test) |