ByteScope

adb shell Command Reference

The adb shell commands worth knowing, one page each — syntax, examples, how to read the output, and which of our tools already runs it for you.

Your files never leave your browser — all processing is local.

← Back to the Web ADB Toolkit

One page per command: the syntax, examples worth copying, what the output means field by field, and a link to the tool on this site that runs it for you.

Prefix any of these with adb shell from your own machine, or type them straight into a device shell.

Packages (pm)

Activities and intents (am)

System services (dumpsys)

Settings provider

Input and touch

Display and capture

Files and storage

System and logs

About this tool

This is a reference for the commands you actually reach for over a USB cable: the package manager, the activity manager, the dumpsys services worth dumping, the settings provider, the input and display commands, and the handful of shell tools Android ships. One page per command, each with the syntax, two to four examples that are not textbook examples, an explanation of what the output means field by field, and — where one exists — a link to the browser tool on this site that runs the command and parses the reply for you.

Why another adb reference

Because most of them are transcriptions of a help text, and a help text does not tell you that Android's du counts 1024-byte blocks rounded up rather than file sizes, that df -h and df -H are indistinguishable in the output, that pm clear --cache-only wipes the entire app on Android 12, that a getevent tracking id of ffffffff means a finger was lifted, or that dumpsys battery reports temperature in tenths of a degree while dumpsys thermalservice reports it as a plain float. Every one of those is a mistake that produces a plausible, wrong answer — and every one of them is on the relevant page here, because we hit it while writing the parsers behind the Web ADB tools.

Android's shell tools are toybox, not GNU

top, df, du and find are toybox implementations, and reading the GNU manual page instead of the toybox source is the single most reliable way to get them wrong. find -size +100 does not mean 100 bytes and does not mean 100 MB; top's sorted column is wrapped in brackets that glue themselves to the column beside it; TIME+ counts total minutes, so two hours of CPU prints as 120:00.00. The pages for those four commands state the behaviour that is actually in the code, with the flag you should send to remove the ambiguity.

Destructive commands are marked, with the way back

Commands that change the device carry a tier and a paragraph naming the exact command that undoes them: pm uninstall -k --user 0 is undone by cmd package install-existing, pm disable-user by pm enable, wm size and wm density by their reset forms, a settings put only by the value you read before writing it. Three commands have no way back at all — pm clear without --cache-only, rm, and an uninstall without -k — and those pages say so in the first paragraph rather than in a footnote. Android has no trash can.

Every page also links to the sub-tool that runs the command, when there is one: the debloat tool for the package commands, the storage analyzer for du, df, find and diskstats, the battery page for dumpsys battery, the sensor tester for getevent. Where no tool of ours runs a command, the page says nothing rather than inventing a link — a reference that oversells is a reference you stop trusting.

Frequently asked questions

Do I need root for these commands?

Almost none of them. Everything on this reference runs as the `shell` user (uid 2000), which is what `adb shell` gives you on any phone with developer options and USB debugging switched on. That user can list and remove packages for its own Android user, read most `dumpsys` services, write the settings provider, inject input, capture the screen and read shared storage. What it cannot do is read another app's private data — the one exception being `run-as` on an app that ships debuggable — or touch `/data/anr`, which is why the crash page uses `dumpsys dropbox` instead.

Why do the same commands behave differently on my phone?

Two separate reasons, and this reference tries to distinguish them. Some behaviour is version-dependent in a way you can look up: `-U` on `pm list packages` arrived in Android 8.0, `--cache-only` in Android 13, `find -printf` in Android 11. The rest is manufacturer patching, and `dumpsys` is where it bites hardest — the text of a dump is whatever the service author last felt like printing, and OEMs both change it and backport their changes. Where that is the situation, the page says the format varies rather than pretending one shape is canonical.

Is it safe to copy these commands straight into a terminal?

The read-only ones, yes. For anything marked as changing the device, read the paragraph next to it first: it names what changes and the command that reverses it. Two habits do most of the work — single-quote every path and URL, because a space or an unquoted `&` changes what the shell runs, and pass one exact target per command rather than a wildcard, so a mistake costs one file instead of a directory tree.

Can I run these from a browser instead?

Many of them, yes. The Web ADB tools on this site talk to a phone over WebUSB from a Chromium-based desktop browser, with no SDK installed and nothing uploaded anywhere — the pages here link to whichever tool runs the command they describe. The limits are honest ones: WebUSB is Chromium-only and desktop-only, only one program can hold the ADB interface at a time (so a desktop `adb server` has to be stopped first), and `adb forward` and `adb reverse` are impossible in a browser because a web page cannot open a TCP listener.