ADB / Shell

ADB Shell Commands Guide: Essential Commands for Power Users

Published: June 30, 2026 Applies to: Windows 10/11, macOS, Linux — Android 5.0 through Android 15

The adb shell command opens a direct window into the Android Linux environment. From there you have access to a toolkit of system utilities that can install and remove apps, control running processes, simulate touch input, read hardware state, and query nearly every configurable value on the device — all without a rooted phone.

Starting an Interactive Shell Session

Running adb shell alone opens an interactive prompt where you type commands one at a time, much like a terminal session on a desktop. The prompt shows the device codename followed by a dollar sign for a standard user or a hash symbol for root. To exit the session, type exit or press Ctrl+D.

For scripting and automation you rarely want the interactive mode. Instead, pass the command directly as an argument: adb shell <command>. This runs the command, prints output to your PC terminal, and returns immediately with the exit code of the remote process. That makes it easy to integrate ADB into shell scripts, Makefiles, or CI pipelines without managing an open session.

Command Quick Reference

Command Purpose Example
pm list packages List all installed package names adb shell pm list packages -3 (third-party only)
pm install Install an APK already on device storage adb shell pm install /sdcard/app.apk
pm uninstall Remove an installed package adb shell pm uninstall com.example.app
am start Launch a specific activity adb shell am start -n com.example.app/.MainActivity
am force-stop Kill all processes for a package adb shell am force-stop com.example.app
settings get/put Read or write system, secure, or global settings adb shell settings put system screen_brightness 128
dumpsys battery Show battery state, voltage, and statistics adb shell dumpsys battery
dumpsys activity Show activity manager state and task stack adb shell dumpsys activity top
input tap Simulate a screen tap at given pixel coordinates adb shell input tap 540 960
input swipe Simulate a swipe gesture with optional duration adb shell input swipe 100 800 100 200 300
input text Type text into the currently focused field adb shell input text "hello"
input keyevent Send a hardware key event by keycode adb shell input keyevent 26 (power button)
getprop Read a system property by key adb shell getprop ro.build.version.release
setprop Set a runtime property adb shell setprop debug.layout true

Package Manager: pm

The package manager shell tool handles everything related to APKs and installed packages. pm list packages accepts several useful flags: -3 filters to third-party packages only, -s restricts output to system packages, and -f appends the APK path on disk to each line. When you are hunting for a specific app, pipe through grep:

adb shell pm list packages -f | grep youtube

To uninstall a system app without root, use the --user 0 flag. This does not remove the APK from the system partition but disables the package entirely for the device owner:

adb shell pm uninstall --user 0 com.bloatware.app

You can restore it later with pm install-existing com.bloatware.app. Note that this approach works per-user — on a device with multiple accounts, the package is only removed for user 0 (the primary user) unless you repeat the command for each user ID.

Activity Manager: am

The activity manager controls the lifecycle of running apps and can launch activities, broadcast intents, and start or stop services. Before using am start, you need the correct component name in the form package/class. The fastest way to find it for a foreground app is:

adb shell dumpsys activity top | grep -E "ACTIVITY|mResumed"

This returns the exact package and class name of the currently visible activity. You can also pass data URIs and extras to simulate deep links or intent-driven navigation:

adb shell am start -a android.intent.action.VIEW -d "https://example.com"

To broadcast a custom intent to a receiver, use am broadcast -a com.example.MY_ACTION. This is useful for triggering background services or testing broadcast receivers without needing a UI.

Input Simulation

The input command is the backbone of ADB-based UI automation. Coordinates for input tap and input swipe are in raw screen pixels. The easiest way to find coordinates is to enable Show pointer location in Developer Options — an on-screen overlay displays exact X/Y values as you touch the screen, updated in real time. The full swipe syntax is input swipe x1 y1 x2 y2 duration_ms, where duration controls how fast the gesture is executed. A 50 ms swipe is nearly instantaneous; 500 ms is slow and deliberate, which is sometimes necessary to trigger scroll or drag behaviors that ignore fast swipes.

For text entry, spaces in the string must be encoded as %s when passed through the shell. For complex strings, it is sometimes easier to build the non-space content with input text and use keycode 62 for spaces: adb shell input keyevent 62. Frequently used keycodes include 3 (Home), 4 (Back), 24 (Volume Up), 25 (Volume Down), and 26 (Power).

System Properties: getprop and setprop

Running adb shell getprop with no arguments dumps the entire system property tree — several hundred lines covering build fingerprints, hardware identifiers, network state, and debug flags. To read a single value, append the property key:

adb shell getprop ro.build.version.sdk
adb shell getprop ro.product.model
adb shell getprop persist.sys.locale

Properties prefixed with ro. are read-only and set at build time; you cannot change them without root. Properties prefixed with debug. are intended for development and can often be set at runtime with setprop, though the changes reset when the affected process restarts. Properties prefixed with persist. survive reboots because they are written to the data partition. Using setprop on persist properties requires root on Android 9 and later due to tightened SELinux policies, but on debug builds many properties remain writable by the shell user.