Zygote
Studybeginner

adb cheat sheet

The sixty commands you actually use, grouped by job: finding processes, reading services, inspecting packages, capturing logs and forcing device states.

5 minAPI 1–37 · 17interactivequizverified 2026-10-27

A reference card, not a tutorial. Every command here is one an Android engineer uses routinely. The labs walk through them with context.

TL;DR#

  • adb shell gets you a shell inside the device; most tools live there.
  • dumpsys <service> is the single most useful command on Android.
  • pm, am and cmd are the entry points to package, activity and service control.

Mental model#

Treat the device as a remote Unix box with three extra command families: one for packages (pm), one for activities and processes (am), and one for arbitrary system-service commands (cmd). Everything else is ordinary Unix.

Where the analogy breaks#

The shell user is not root. The shell UID has its own privileges and its own SELinux domain, so some paths and services are invisible to it even though adb feels privileged.

The big picture#

Loading diagram…
Text description of this diagram

The Android stack, with each adb command family mapped to the layer it inspects. The device shell reaches the kernel through proc and sys, the native daemons through service list and dumpsys, the framework services through dumpsys and cmd, and apps through pm and am.

Deep dive#

Connection#

adb devices
adb pair 192.168.1.20:37000     # wireless pairing, Android 11+
adb connect 192.168.1.20:5555
adb disconnect
adb kill-server && adb start-server

Processes and UIDs#

adb shell ps -A                       # all processes
adb shell ps -A -o USER,PID,PPID,NAME # with parent and owner
adb shell ps -T -p 1234               # threads in one process
adb shell cat /proc/1234/status       # process details
adb shell cat /proc/1234/oom_score_adj
adb shell top                         # live CPU
adb shell pidof com.android.chrome

Services and the framework#

adb shell service list                # every registered binder service
adb shell dumpsys -l                  # every service with a dump() implementation
adb shell dumpsys activity activities # task and activity stack
adb shell dumpsys activity processes  # process list with adj values
adb shell dumpsys window windows      # window list and focus
adb shell dumpsys window displays     # display and inset state
adb shell dumpsys package com.example
adb shell dumpsys meminfo com.example
adb shell dumpsys gfxinfo com.example framestats
adb shell dumpsys batterystats --charged
adb shell dumpsys jobscheduler
adb shell dumpsys alarm
adb shell dumpsys notification --noredact
adb shell cmd activity ...
adb shell cmd package ...

Packages#

adb shell pm list packages
adb shell pm list packages -3          # third-party only
adb shell pm list packages -s          # system only
adb shell pm path com.example
adb shell pm grant com.example android.permission.CAMERA
adb shell pm revoke com.example android.permission.CAMERA
adb shell pm clear com.example
adb shell pm dump com.example
adb install -r app.apk
adb install-multiple base.apk split_config.arm64_v8a.apk
adb uninstall com.example

Activities and processes#

adb shell am start -n com.example/.MainActivity
adb shell am start -W -a android.intent.action.VIEW -d https://example.com
adb shell am force-stop com.example    # kill and stop everything
adb shell am kill com.example          # kill only if background-safe
adb shell am broadcast -a com.example.PING
adb shell am set-standby-bucket com.example rare
adb shell am get-standby-bucket com.example
adb shell am send-trim-memory com.example RUNNING_LOW

Properties and settings#

adb shell getprop | grep ro.build
adb shell getprop dalvik.vm.heapsize
adb shell settings list global
adb shell settings get global airplane_mode_on
adb shell settings put global window_animation_scale 0
adb shell cmd deviceidle force-idle
adb shell cmd deviceidle unforce

Logs#

adb logcat
adb logcat -b main -b system -b crash
adb logcat -s AndroidRuntime:E
adb logcat --pid=$(adb shell pidof com.example)
adb logcat -c                          # clear
adb bugreport bugreport.zip
adb shell ls /data/anr/

Files and screenshots#

adb pull /sdcard/Download/file.txt
adb push local.txt /sdcard/Download/
adb exec-out screencap -p > screen.png
adb exec-out screenrecord --time-limit 10 /sdcard/rec.mp4
adb shell input tap 540 1200
adb shell input swipe 500 1500 500 300 300
adb shell input text "hello"
adb shell uiautomator dump && adb shell cat /sdcard/window_dump.xml

Tracing#

adb shell perfetto -o /data/misc/perfetto-traces/trace -t 10s sched freq idle am wm gfx view binder_driver
adb pull /data/misc/perfetto-traces/trace
adb shell atrace --list_categories

How it evolved#

2008 →USB onlyadb over USB, with a fixed device serial.
Android 11 →Wirelessadb pair and connect over Wi-Fi with a pairing code.
Android 11 →Incrementaladb install --incremental streams the APK while launching.

Curiosity corner#

  • dumpsys calls a method on the service. It is not a special debugging channel; it invokes dump() over Binder, which is why output quality varies so much between services.
  • am kill and am force-stop are different. One respects the system's rules; the other does not.

Try it#

The labs are the guided version of this sheet. Start at Lab 1.

Check yourself#

Check yourself

1 / 12

What does an API level identify?

0 answered · 0 correct

Sources#

Sources

Every version number, API level, class name and date on this page is traced to one of these. Pages are re-verified against them; last_verified above says when.

  1. docsAndroid Debug Bridge (adb)developer.android.comaccessed 2026-10-27↩
  2. docsdumpsysdeveloper.android.comaccessed 2026-10-27↩