Skip to content

ADB

31 commands

Android Debug Bridge: install apps, open a shell, pull files, forward ports and read logs on Android devices and emulators.

  • Android
  • debugging

Install ADB

sudo apt install adb

Devices6

adb devices -l

Lists connected devices and emulators with model and transport ID. “unauthorized” means you must accept the prompt on the device.

Link
adb -s <serial> <command>

Targets one device when several are connected.

Link
adb tcpip 5555

Restarts adbd listening on TCP so you can disconnect the cable.

Link
adb connect <ip>:<port>

Connects over the network.

Link
adb pair <ip>:<port>

Pairs with Android 11+ wireless debugging using the code shown on the device.

Link
adb kill-server && adb start-server

Restarts the local adb server when devices stop showing up.

Link

Shell5

adb shell

Opens an interactive shell on the device.

adb shell <command>

Runs a single command — here, printing the Android version.

Link
adb root

Restarts adbd as root. Works on emulators and userdebug builds, not on production phones.

adb shell "su -c <command>"

Runs a command as root on a rooted device.

Link
adb shell getprop

Every system property: build fingerprint, security patch level, debuggable flag and more.

Link

Apps9

adb install <apk>

Installs an APK. -r reinstalls keeping data; -g grants all runtime permissions.

Link
adb install-multiple <apks>

Installs a split APK set.

Link
adb uninstall <package>

Removes an app. -k keeps its data.

Link
adb shell pm list packages -3

Third-party packages. Add -f to show the APK path.

Link
adb shell pm path <package>

Where the APK lives, so you can pull it.

Link
adb shell dumpsys package <package>

Permissions, activities, version and signing details.

Link
adb shell am start -n <package>/<activity>

Launches an activity, including non-exported ones when run as root.

Link
adb shell am force-stop <package>

Kills an app.

Link
adb shell run-as <package> ls files

Accesses a debuggable app’s private data without root.

Link

Files and logs6

adb pull <remote> <local>

Copies from the device.

Link
adb push <local> <remote>

Copies to the device; /data/local/tmp is writable and executable.

Link
adb logcat

Streams the system log.

adb logcat --pid=$(adb shell pidof -s <package>)

Logs from a single app — watch for leaked tokens and debug output.

Link
adb logcat -c

Clears the log buffer.

Link
adb bugreport <file>.zip

Collects a full diagnostic bundle.

Link

Network and screen5

adb forward tcp:<local> tcp:<remote>

Forwards a local port to the device — used by Frida and debuggers.

Link
adb reverse tcp:<remote> tcp:<local>

Lets the device reach a port on your computer, for example an intercepting proxy.

Link
adb shell settings put global http_proxy <ip>:<port>

Sets a global HTTP proxy; reset with :0.

Link
adb exec-out screencap -p > <file>

Takes a screenshot.

Link
adb shell screenrecord /sdcard/<file>

Records the screen (up to three minutes).

Link