- Published on
Essential ADB Commands: A Practical Developer Cheat Sheet
- Authors

- Name
- Khalil
- @Im_Khalil
Whether you are debugging an Android application, capturing crash logs, debloating OEM bloatware, or automating test scripts, the Android Debug Bridge (ADB) is an indispensable tool in your developer arsenal.
While ADB has dozens of subcommands and flags, you only need a handful of them for 95% of daily engineering tasks.
Here is a curated, field-tested cheat sheet of the most useful ADB and Fastboot commands, grouped by practical workflow.
0. Quick Setup: Getting Connected
Before running ADB commands, make sure:
- Developer Options is enabled on your device (Settings > About Phone > Tap "Build Number" 7 times).
- USB Debugging is turned On (Settings > System / Developer options > USB debugging).
- Connect your phone via USB and run:
adb devices
If it shows unauthorized, unlock your phone and tap "Always allow from this computer" when the RSA key prompt appears. Once authorized, you will see device next to your serial number.
1. Wireless Debugging (No USB Cable Needed)
Tired of having a cable tethered to your laptop? You can switch ADB to Wi-Fi mode:
On Android 11+:
Go to Developer Options > Wireless debugging, tap Pair device with pairing code, then run:
adb pair <ip-address>:<pairing-port>
adb connect <ip-address>:<connect-port>
On Older Android Versions (Initial cable connection required):
- Connect via USB once and run:
adb tcpip 5555 - Find your phone's IP address (Settings > About Phone > Status / IP address) and disconnect the USB cable:
adb connect 192.168.1.50:5555 - To switch back to USB mode later:
adb usb
2. App & APK Management
Installing and Updating Apps
# Basic install
adb install app-debug.apk
# Reinstall / Update while keeping existing app data and cache (-r)
adb install -r app-debug.apk
# Allow version downgrade (-d)
adb install -r -d app-release.apk
# Grant all runtime permissions automatically upon install (-g)
adb install -g app-debug.apk
Listing Installed Packages
# List all packages
adb shell pm list packages
# List only third-party (user-installed) apps
adb shell pm list packages -3
# Filter packages by keyword
adb shell pm list packages | grep "mycompany"
Uninstalling & Debloating OEM Apps
# Standard uninstall
adb uninstall com.example.myapp
# Uninstall while keeping app cache and data (-k)
adb uninstall -k com.example.myapp
# Debloat system/pre-installed apps without root (for current user)
adb shell pm uninstall -k --user 0 com.samsung.android.bixby.agent
3. Logcat & Live Debugging
Raw adb logcat is like drinking from a firehose. Filter it effectively to see only what matters:
# Clear previous log buffer before starting your test
adb logcat -c
# Filter by specific Tag and Log Level (e.g. MyTag at DEBUG level, suppress all others)
adb logcat -s MyTag:D
# Filter only errors and fatal crashes across all apps
adb logcat *:E
# Filter logs for a specific PID (Process ID)
adb logcat --pid=$(adb shell pidof -s com.example.myapp)
# Output formatted logs with timestamps to a local file
adb logcat -v time > crash_dump.log
4. File Transfers & Shell Commands
Pushing and Pulling Files
# Copy file from PC to phone's downloads folder
adb push my-data.json /sdcard/Download/
# Copy file or directory from phone to local PC
adb pull /sdcard/Download/exported_logs.zip ./logs/
Screen Capture & Recording
# Take a screenshot and save directly to phone
adb shell screencap -p /sdcard/screenshot.png
adb pull /sdcard/screenshot.png ./
# Record screen video (MP4) — press Ctrl+C to stop recording
adb shell screenrecord /sdcard/demo.mp4
adb pull /sdcard/demo.mp4 ./
Simulating User Input & Typing
# Type text into the active input field (great for long test passwords)
adb shell input text "SecretPassword123"
# Simulate physical button presses
adb shell input keyevent 26 # Power button toggle
adb shell input keyevent 3 # Home button
adb shell input keyevent 4 # Back button
adb shell input keyevent 224 # Wake screen
# Tap specific screen coordinates (X, Y)
adb shell input tap 500 1200
5. Simulating Edge Cases & Device State
ADB lets you simulate environment changes without manually messing with physical hardware:
# Mock battery level to 15% (for testing low-battery app alerts)
adb shell dumpsys battery set level 15
# Unplug virtual AC power
adb shell dumpsys battery unplug
# Reset battery status back to actual physical state
adb shell dumpsys battery reset
# Force-stop an unresponsive app process
adb shell am force-stop com.example.myapp
# Clear all app storage and cache
adb shell pm clear com.example.myapp
6. Fastboot & Bootloader Essentials
When modifying firmware, flashing recoveries, or working with unlocked bootloaders:
# Reboot directly into Fastboot/Bootloader mode
adb reboot bootloader
# Reboot directly into Recovery mode (TWRP / stock recovery)
adb reboot recovery
# Check connected devices in Fastboot mode
fastboot devices
# Boot a custom recovery image temporarily without flashing it to device
fastboot boot recovery.img
# Flash a partition image (e.g. boot, recovery, system)
fastboot flash boot boot.img
fastboot flash recovery recovery.img
# Reboot back to system from Fastboot
fastboot reboot
Quick Reference Summary
| Task | Command |
|---|---|
| List connected devices | adb devices |
| Connect wirelessly | adb connect <ip>:5555 |
| Reinstall APK preserving data | adb install -r app.apk |
| Filter error logs | adb logcat *:E |
| Debloat user app | adb shell pm uninstall -k --user 0 <package> |
| Take screenshot | adb shell screencap -p /sdcard/s.png |
| Input long text | adb shell input text "<string>" |
| Reboot to bootloader | adb reboot bootloader |
Bookmark this cheat sheet for quick reference during testing and development sessions.
You might also like to read
- 1.How to Disable Annoying Chrome Notifications on Desktop and Mobile
- 2.AEM Best Practices - When to Close Your ResourceResolver and When Not To
- 3.How to Add Emergency Contact and Medical Info to Your Phone's Lock Screen (Android & iPhone)
- 4.How to enable God Mode in windows
- 5.How to monitor replication queues in AEM