adb (Android Debug Bridge) cheatsheet

Android Debug Bridge (adb) is a 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. It is a client-server program that includes three components:

  • A client, which sends commands. The client runs on your development machine. You can invoke a client from a command-line terminal by issuing an adb command.
  • A daemon (adbd), which runs commands on a device. The daemon runs as a background process on each device.
  • A server, which manages communication between the client and the daemon. The server runs as a background process on your development machine.

The following tables are the most commands that we are using with Android Devices :

Device Basics

adb devicesLists connected devices
adb devices -lLists connected devices and kind
adb rootRestarts adbd with root permissions
adb start-serverStarts the adb server
adb kill-serverKills the adb server
adb remountRemounts file system with read/write access
adb rebootReboots the device
adb reboot bootloaderReboots the device into fastboot

Remote Shell

adb shell <command>Runs the specified command on device (most unix commands work here)
adb shell wm sizeDisplays the current screen resolution
adb shell wm size WxHSets the resolution to WxH
adb shell pm list packagesLists all installed packages
adb shell pm list packages -3Lists all installed 3rd-party packages
adb shell monkey -p app.package.nameStarts the specified package

File Management

adb push <local> <remote>Copies the local to the device at remote
adb pull <remote> <local>Copies the remote from the device to local

Good luck!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.