ADB Command Cheat Sheet
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 and details |
| — | — |
adb root |
Restart with root permissions |
adb start-server |
Start adb server |
adb kill-server |
Kill adb server |
adb remount |
Remount file system with read/write access |
adb reboot |
Restart device |
adb reboot bootloader |
Enter bootloader mode |
adb disable-verity |
Disable dm-verity checks |
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.
Example
$ 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 buffer size (K or M) |
adb logcat -c |
Clear log buffer |
adb logcat *:V |
Enable all log messages (verbose) |
adb logcat -f <filename> |
Dump to specified file |
Example
$ adb logcat -G 16M
$ adb logcat *:V > output.logFile Management
| Command | Description |
|---|---|
adb push <local> <remote> |
Copy local file to remote device |
adb pull <remote> <local> |
Copy remote device file to local |
Example
$ echo "This is a test" > test.txt
$ adb push test.txt /sdcard/test.txt
$ adb pull /sdcard/test.txt pulledTest.txtRemote Scripts
| Command | Description |
|---|---|
adb shell <command> |
Run specified command on device (most unix commands work here) |
adb shell wm size |
Show current screen resolution |
adb shell wm size WxH |
Set 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 specified package |