Skip to main content
Android Debug Bridge:

adb cheat sheet

Summary

This Android Debug Bridge (adb) cheat sheet helps you control, debug, and manage Android devices via command line. It covers device connections, app management, file operations, logging, and automation in categorized tables.

Introduction #

Android Debug Bridge (adb) is a versatile command-line tool that allows you to communicate with Android devices. It is part of the Android Software Development Kit (SDK) and is primarily used for app debugging, file transfer, device management, and accessing system features via shell.

Command reference #

This cheat sheet provides commands for device control, debugging, app management, file operations, and automation.

Device connection & control #

Commands for detecting, connecting, and managing devices.

CommandDescription
adb devicesLists all connected devices (USB/Wi-Fi).
adb -s <serial> <command>Targets a specific device (if multiple connected).
adb tcpip 5555Enables TCP/IP debugging (Wi-Fi mode).
adb connect <IP>:5555Connects to a device over Wi-Fi.
adb disconnectDisconnects all network devices.
adb kill-serverForce-stops the ADB server.
adb start-serverRestarts the ADB server.
adb rebootReboots the device normally.
adb reboot recoveryReboots into recovery mode.
adb reboot bootloaderReboots into fastboot/bootloader mode.
adb rootRestarts ADB with root permissions (if supported).
adb remountRemounts /system as writable (requires root).

App management #

Commands for installing, uninstalling, and debugging apps.

CommandDescription
adb install app.apkInstalls an APK file.
adb install -r app.apkReinstalls while keeping data.
adb install -tAllows test packages.
adb install -dAllows downgrading an app.
adb uninstall com.example.pkgUninstalls an app.
adb uninstall -k com.example.pkgUninstalls but keeps data.
adb shell pm list packagesLists all installed apps.
adb shell pm list packages -3Lists only third-party apps.
adb shell pm path com.example.pkgShows APK path of an app.
adb shell cmd package install-existing com.example.pkgReinstalls a preinstalled app.
adb shell am start -n com.example.pkg/.MainActivityLaunches an app.
adb shell am force-stop com.example.pkgForce-stops an app.

File operations #

Commands for transferring and managing files.

CommandDescription
adb push local.txt /sdcard/remote.txtCopies a file to the device.
adb pull /sdcard/remote.txt local.txtCopies a file from the device.
adb syncSyncs files between PC and device.
adb shell ls /sdcardLists files in a directory.
adb shell rm /sdcard/file.txtDeletes a file.
adb shell mkdir /sdcard/new_folderCreates a directory.
adb shell screencap /sdcard/screen.pngTakes a screenshot.
adb shell screenrecord /sdcard/video.mp4Records screen (stop with Ctrl+C).

Debugging & logs #

Commands for log inspection and system diagnostics.

CommandDescription
adb logcatShows real-time system logs.
adb logcat -cClears the log buffer.
adb logcat -d > log.txtDumps logs to a file.
adb logcat ActivityManager:I *:SFilters logs by tag/priority.
adb logcat --pid=$(adb shell pidof -s com.example.pkg)Logs only a specific app.
adb bugreport bugreport.zipGenerates a detailed bug report.
adb shell dumpsys batteryShows battery status.
adb shell dumpsys wifiShows Wi-Fi info.
adb shell dumpsys meminfo com.example.pkgShows app memory usage.
adb shell top -n 1Lists CPU usage of processes.
adb shell psLists running processes.
adb shell netstatShows network connections.

Automation & input simulation #

Commands for UI testing and automation.

CommandDescription
adb shell input keyevent KEYCODE_HOMESimulates a Home button press.
adb shell input tap 500 500Taps at (x, y) coordinates.
adb shell input swipe 100 500 900 500 200Swipes (x1,y1 to x2,y2 in 200ms).
adb shell input text "Hello"Types text into a field.
adb shell uiautomator dump /sdcard/ui.xmlDumps UI hierarchy for automation.
adb shell settings put global airplane_mode_on 1Toggles airplane mode (1=on, 0=off).
adb shell settings put system screen_brightness 50Sets screen brightness (0-255).

Backup & restore #

Commands for device backups (may not work on newer Android versions).

CommandDescription
adb backup -apk -shared -all -f backup.abCreates a full backup.
adb restore backup.abRestores from a backup.

Fastboot basics #

Useful when the device is in bootloader mode (adb reboot bootloader).

CommandDescription
fastboot devicesLists connected fastboot devices.
fastboot rebootExits fastboot and reboots.
fastboot flash recovery recovery.imgFlashes a custom recovery.
fastboot oem unlockUnlocks the bootloader (wipes data).

FAQ's #

Most common questions and brief, easy-to-understand answers on the topic:

What is Android Debug Bridge (adb)?

Android Debug Bridge (adb) is a command-line tool that allows you to communicate with Android devices for development and debugging tasks.

How do I check if adb is installed?

You can run adb version in your terminal. If adb is installed, it will display the version information.

How do I connect a device over Wi-Fi using adb?

Enable TCP/IP on the device using adb tcpip 5555, find the IP address, then run adb connect DEVICE_IP:5555.

How do I install an APK using adb?

Use adb install path/to/app.apk to install an Android Package Kit (APK) file on the connected device.

Can I use adb without USB debugging enabled?

No, USB debugging must be enabled on the Android device to allow adb to communicate with it.

Further readings #

Sources and recommended, further resources on the topic:

Author

Jonas Jared Jacek • J15k

Jonas Jared Jacek (J15k)

Jonas works as project manager, web designer, and web developer since 2001. On top of that, he is a Linux system administrator with a broad interest in things related to programming, architecture, and design. See: https://www.j15k.com/

License

adb cheat sheet by Jonas Jared Jacek is licensed under CC BY-SA 4.0.

This license requires that reusers give credit to the creator. It allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, for noncommercial purposes only. To give credit, provide a link back to the original source, the author, and the license e.g. like this:

<p xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/"><a property="dct:title" rel="cc:attributionURL" href="https://www.ditig.com/adb-cheat-sheet">adb cheat sheet</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://www.j15k.com/">Jonas Jared Jacek</a> is licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="license noopener noreferrer">CC BY-SA 4.0</a>.</p>

For more information see the Ditig legal page.

All Topics

Random Quote

“Less is more.”

Ludwig Mies van der Rohe German architect and designerWord of mouth, - IT quotes