ACC Logo
Tool Documentation

ADB Commands Reference

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.

Getting Started with ADB
TOTAL COMMANDS 65 indexed
CATEGORIES 12 sections
PORT (DEFAULT) TCP 5037
RUNTIME PROTOCOL USB & TCP/IP
Risk:
Showing 65 commands
Device & ConnectionSafe
$adb devices
What it does:

Queries the ADB server and displays all detected Android devices and emulators along with their connection state.

Device & ConnectionSafe
$adb devices -l
What it does:

Outputs all connected devices including their hardware product code, device codename, marketing model, and transport ID.

Device & ConnectionSafe
$adb connect <ip>:<port>
What it does:

Establishes a wireless ADB connection to an Android device over TCP/IP using its IP address and listening port (default 5555).

Device & ConnectionSafe
$adb disconnect [ip:port]
What it does:

Terminates an active TCP/IP wireless ADB connection to a specific device, or disconnects all TCP devices if no address is supplied.

Device & ConnectionSafe
$adb pair <ip>:<port> [pairing_code]
What it does:

Pairs a computer with an Android 11+ device using TLS authentication and a 6-digit one-time pairing code from Developer Options.

Device & ConnectionSafe
$adb wait-for-device
What it does:

Blocks command execution until the connected device is fully booted and accepted by the ADB daemon. Essential for automation and CI/CD pipelines.

Device & ConnectionSafe
$adb get-state
What it does:

Returns the current low-level ADB transport status of the connected device: offline, bootloader, or device.

Device & ConnectionSafe
$adb get-serialno
What it does:

Outputs the unique hardware serial number assigned to the connected Android device.

Device & ConnectionSafe
$adb start-server
What it does:

Launches the local ADB host background server on localhost port 5037 if it is not already running.

Device & ConnectionSafe
$adb kill-server
What it does:

Kills the local ADB background daemon process. Resolves hung connections, unresponsive states, and stuck USB ports.

App ManagementSafe
$adb install <path_to_apk>
What it does:

Pushes an APK file to the device and invokes the package manager to install it.

App ManagementSafe
$adb install-multiple <apk1> <apk2> ...
What it does:

Installs multi-split APK packages (base.apk plus config and density splits) in a single atomic atomic session.

App ManagementCaution
$adb uninstall <package_name>
What it does:

Removes the installed application package and deletes its private data directories from /data/data.

App ManagementSafe
$adb shell pm list packages
What it does:

Queries the Package Manager service and prints the complete list of package names installed on the system.

App ManagementSafe
$adb shell pm path <package_name>
What it does:

Prints the physical filesystem path where the base APK and splits for the specified package are stored on the Android filesystem.

App ManagementCaution
$adb shell pm clear <package_name>
What it does:

Clears all user data, database records, shared preferences, and cache files associated with a package, resetting it to factory fresh install state.

App ManagementCaution
$adb shell pm disable-user --user 0 <package_name>
What it does:

Disables a pre-installed carrier or OEM bloatware app for the primary user without requiring root privileges.

App ManagementSafe
$adb shell pm enable <package_name>
What it does:

Re-activates a frozen or disabled application package, restoring its launcher icon and background services.

Files & StorageSafe
$adb push <local_path> <remote_path>
What it does:

Transfers a file or folder from the host development machine to a specified path on the Android filesystem.

Files & StorageSafe
$adb pull <remote_path> [local_path]
What it does:

Downloads a file or directory tree from the Android device to the specified local directory on the host computer.

Files & StorageSafe
$adb shell ls -la <path>
What it does:

Lists all files, hidden items, owner permissions, SELinux contexts, and timestamps inside an Android directory.

Files & StorageDestructive
$adb shell rm -rf <path>
What it does:

Deletes a file or directory tree from the Android storage volume.

Files & StorageSafe
$adb shell df -h
What it does:

Displays storage statistics, free space, and mount points across all mounted Android filesystem partitions in human-readable units.

ShellSafe
$adb shell
What it does:

Launches an interactive pseudo-terminal shell session directly on the target Android operating system.

ShellSafe
$adb shell getprop [key]
What it does:

Reads Android runtime properties from the system property store, or dumps all system properties if no key is provided.

ShellCaution
$adb shell setprop <key> <value>
What it does:

Sets a runtime system property in the Android init environment. Useful for testing debug flags, mock sensors, and developer parameters.

ShellSafe
$adb shell whoami
What it does:

Displays the user ID name running the current ADB shell process (e.g. shell, root, or u0_a...).

DebuggingSafe
$adb shell am start -n <package>/<activity>
What it does:

Uses Activity Manager to launch an explicit Android activity by its full package and component name.

DebuggingSafe
$adb shell am start -a android.intent.action.VIEW -d <url>
What it does:

Dispatches an implicit VIEW intent to test deep links, universal links, or open a web page in the default web browser.

DebuggingSafe
$adb shell am force-stop <package_name>
What it does:

Terminates all processes, background services, alarms, and notifications associated with the specified package immediately.

DebuggingSafe
$adb shell input keyevent <keycode>
What it does:

Sends a simulated hardware key code event to the device window manager (e.g. Home, Back, Power, Volume).

DebuggingSafe
$adb shell input text <string>
What it does:

Types a sequence of characters into whichever text input or edit field currently has focus on the Android screen.

DebuggingSafe
$adb shell input tap <x> <y>
What it does:

Simulates a finger tap event at the specified pixel coordinates (X, Y) on the display.

DebuggingSafe
$adb shell input swipe <x1> <y1> <x2> <y2> [duration_ms]
What it does:

Simulates a finger drag or swipe motion from starting coordinates (x1, y1) to ending coordinates (x2, y2). Useful for scrolling and drag-and-drop.

DebuggingSafe
$adb bugreport [zip_file]
What it does:

Captures a complete snapshot of system diagnostics, dumpsys logs, battery history, ANR traces, and radio states into a ZIP archive.

LogsSafe
$adb logcat
What it does:

Streams continuous real-time diagnostic output from the Android log ring buffer.

LogsSafe
$adb logcat -c
What it does:

Flushes and empties the entire Android log ring buffer history so subsequent logcat commands show only fresh events.

LogsSafe
$adb logcat *:E
What it does:

Filters the system log stream to isolate critical system and application exceptions and errors (log level Error & Fatal).

LogsSafe
$adb logcat -d > log.txt
What it does:

Dumps the current contents of the circular log buffer to a local text file on the development computer and exits.

Screenshots & RecordingSafe
$adb exec-out screencap -p > screenshot.png
What it does:

Captures the active Android screen framebuffer and pipes the PNG stream directly to a file on your local machine without needing intermediate device storage.

Screenshots & RecordingSafe
$adb shell screencap -p /sdcard/screenshot.png
What it does:

Captures a screenshot and saves it as an image file on the internal SD card storage.

Screenshots & RecordingSafe
$adb shell screenrecord /sdcard/demo.mp4
What it does:

Records high-definition screen video of device activity to an MP4 video file on the device. Press Ctrl+C to terminate recording.

Reboot & RecoverySafe
$adb reboot
What it does:

Restarts the Android operating system into normal user mode.

Reboot & RecoverySafe
$adb reboot bootloader
What it does:

Reboots the device into the bootloader interface where low-level Fastboot flashing commands can be executed.

Reboot & RecoverySafe
$adb reboot recovery
What it does:

Reboots the device into Android recovery console (Stock Recovery or custom TWRP/OrangeFox) for OTAs and wipes.

Reboot & RecoverySafe
$adb reboot fastboot
What it does:

Reboots Android 10+ devices into fastbootd (userspace fastboot), allowing partition resizing and flashing dynamic logical partitions (system, vendor, product).

Reboot & RecoveryCaution
$adb reboot edl
What it does:

Reboots Qualcomm-based Snapdragon devices directly into Emergency Download (EDL / 9008) mode for low-level unbricking.

Reboot & RecoveryCaution
$adb sideload <update.zip>
What it does:

Sends and installs a full OTA package or custom ROM ZIP archive to a device booted into Recovery Mode with "Apply update from ADB" active.

PermissionsSafe
$adb shell pm grant <package> <permission>
What it does:

Grants a declared runtime permission (e.g. WRITE_SECURE_SETTINGS, ACCESS_FINE_LOCATION) to an app without user prompt.

PermissionsSafe
$adb shell pm revoke <package> <permission>
What it does:

Revokes a previously granted runtime permission from the specified application.

PermissionsCaution
$adb shell pm reset-permissions
What it does:

Resets all granted runtime permissions for all installed applications back to default factory states.

NetworkSafe
$adb tcpip 5555
What it does:

Instructs the connected device to listen for ADB connections on network TCP port 5555, allowing USB cable removal for wireless debugging.

NetworkSafe
$adb forward tcp:<local_port> tcp:<remote_port>
What it does:

Sets up socket forwarding from a port on the host computer to a port or socket on the Android device.

NetworkSafe
$adb reverse tcp:<remote_port> tcp:<local_port>
What it does:

Allows network requests originating on the Android device to route back into a server running on your computer localhost (e.g. dev server on port 3000).

NetworkSafe
$adb forward --list
What it does:

Displays all currently established local-to-remote socket forwarding tunnels.

SystemSafe
$adb shell dumpsys battery
What it does:

Prints current battery charge level, voltage, battery temperature, health status, and charging source (AC/USB/Wireless).

SystemSafe
$adb shell dumpsys battery set level <percentage>
What it does:

Overrides Android OS battery percentage reporter for testing low-battery notifications and power-saving modes.

SystemSafe
$adb shell dumpsys meminfo [package_name]
What it does:

Dumps deep RAM allocation statistics including Native Heap, Dalvik Heap, Graphics buffers, and PSS memory for an app or the whole system.

SystemSafe
$adb shell dumpsys cpuinfo
What it does:

Outputs CPU workload percentages consumed by individual apps, system services, and kernel threads over the recent sampling window.

SystemCaution
$adb shell wm size [widthxheight|reset]
What it does:

Reads the physical display resolution or overrides it to test responsive UI layouts across various screen resolutions.

SystemCaution
$adb shell wm density [dpi|reset]
What it does:

Adjusts the software DPI (density-independent dots per inch) scale factor of the Android display.

AdvancedCaution
$adb root
What it does:

Restarts the on-device adbd daemon with root privileges (available on userdebug, eng, or rooted custom firmware builds).

AdvancedSafe
$adb unroot
What it does:

Restarts the on-device adbd daemon back into unprivileged standard shell user context.

AdvancedCaution
$adb remount
What it does:

Remounts /system, /vendor, and /product partitions as read-write, enabling manual modification of system binaries and APKs.

AdvancedDestructive
$adb disable-verity
What it does:

Disables Device Mapper Verity (dm-verity) cryptographic block integrity enforcement on userdebug builds to allow system partition modifications.