Android Debug Bridge (ADB)
ADB is a command-line tool from the Android SDK that lets you communicate with an Android device or emulator. It is mainly used for app installation, debugging, file transfer, and accessing a device shell. It works using a client–server–daemon model and is widely used in Android development and security testing.
Cheatsheet
# == Device Management ==
adb devices # list connected devices
adb devices -l # detailed device info
adb start-server # start adb daemon on host
adb kill-server # stop adb daemon
adb get-state # check device state
adb get-serialno # get device serial number
# == Shell Access ==
adb shell # open interactive Android shell
adb shell whoami # check current user
adb shell id # show user/group info
adb shell <command> # run single command on device
adb -s <device_id> shell # target specific device
# == Root / Privileged Access (emulator/debug builds only) ==
adb root # restart adbd as root
adb remount # remount system partitions as writable
adb shell whoami # verify root access
# == App Management ==
adb install app.apk # install APK
adb install -r app.apk # reinstall/replace app
adb uninstall com.package.name # remove app
adb shell pm list packages # list all installed packages
adb shell pm list packages -3 # list user-installed apps
adb shell pm path com.package.name # get APK path
# == File Transfer ==
adb push file.txt /sdcard/Download/ # upload file to device
adb pull /sdcard/Download/file.txt . # download file from device
adb shell ls /sdcard/ # list storage files
adb shell cat /sdcard/Download/file.txt # read file content
# == Process / Activity Control ==
adb shell ps # list running processes
adb shell top # live process monitoring
adb shell am start -n com.app/.MainActivity # launch activity
adb shell am force-stop com.package.name # stop app
# == Logs & Debugging ==
adb logcat # show device logs
adb logcat -d # dump logs and exit
adb logcat *:V # verbose logging
adb bugreport # full system diagnostic report
# == Device Control ==
adb reboot # reboot device
adb reboot recovery # reboot into recovery mode
adb reboot bootloader # reboot into bootloader/fastboot
# == Wireless ADB ==
adb tcpip 5555 # enable TCP/IP mode
adb connect <ip>:5555 # connect over network
adb pair <ip>:<port> # pair wireless debugging
adb disconnect # disconnect all devices
# == Package / Intent Tricks ==
adb shell monkey -p com.package.name 1 # launch app via monkey tool
adb shell dumpsys package com.package.name # deep package info
adb shell cmd activity list packages # list activity packages
# == Storage & Sensitive Areas ==
adb shell ls /sdcard/ # shared storage
adb shell ls /data/data/ # app private storage (restricted)
adb shell cat /data/data/<package>/files/ # read app files
adb shell find / -name flag.txt # search file system
# == File Extraction (common testing flow) ==
adb install myapp.apk # install target app
adb shell am start -n com.rezydev.app/.MainActivity # launch app
adb shell cat /sdcard/Download/flag.txt # read external flag
adb shell cat /data/data/com.rezydev.app/files/flag.txt # read internal flag
adb shell unzip /sdcard/Download/flag.zip # extract archives
# == Debug Utilities ==
adb shell getprop # view system properties
adb shell settings list system # system settings dump
adb shell settings list secure # secure settings dump
adb shell dumpsys activity # activity stack info
adb shell dumpsys window # window focus info