Welcome to my ADB Cheatsheet! This repository serves as a personal collection of Android Debug Bridge (ADB) commands that I frequently use. I decided to share it since there are very few comprehensive ADB wikis out there. Hopefully, you'll find this cheatsheet helpful for managing your Android devices via ADB.
This page is far from complete – I update it daily, so feel free to check back for more commands and tips!
- Introduction
- Getting Started
- Basic Commands
- ADB Package Manager
- Logcat
- Dumpsys
- Dumpstate
- AM (Activity Manager)
- IMEI Commands
- Miscellaneous
- Contributing
- License
ADB (Android Debug Bridge) is a versatile tool that lets you communicate with Android devices from a computer. It's commonly used by developers and testers for debugging apps, accessing device features, transferring files, and more.
This cheatsheet focuses on ADB commands that you can run directly from your terminal or command line, avoiding the use of adb shell
for simplicity. However, if you prefer to work within an ADB shell, simply prefix your commands with adb shell
.
To get started with ADB, make sure that:
- ADB is installed on your system. You can install it as part of the Android SDK or via other package managers.
- USB Debugging is enabled on your Android device under Developer Options.
adb start-server # Start ADB server
adb stop-server # Stop ADB server
adb kill-server # Kill ADB server
adb tcpip <port>
adb connect <device_ip>
adb devices
Here are some essential ADB commands for managing devices:
Command | Description |
---|---|
adb reboot |
Reboot the device |
adb reboot recovery |
Reboot into recovery mode |
adb reboot bootloader |
Reboot into bootloader mode |
adb install <apk_file> |
Install an APK on the device |
adb uninstall <package_name> |
Uninstall an app from the device |
adb pull <source> <destination> |
Pull a file or directory from the device |
adb push <source> <destination> |
Push a file or directory to the device |
Manage apps on your Android device using the package manager (PM):
-
List Installed Packages:
pm list packages
-
Uninstall a Package:
pm uninstall --user 0 com.package.name
-
Grant/Revoke Permissions:
pm grant com.package android.permission.READ_LOGS pm revoke com.package android.permission.READ_LOGS
-
Clear Application Data:
pm clear <package_name>
Logcat helps you view logs generated by the Android system, apps, and services.
-
View Logs:
adb logcat
-
Filter Logs by Priority:
adb logcat *:E # Show only error messages
-
Clear Log Buffer:
adb logcat -c
-
Save Logs to a File:
adb logcat -f <filename>
dumpsys
is a powerful tool to dump system information about services, apps, and hardware on your device.
-
List All Active Services:
adb shell dumpsys -l
-
Show Bluetooth Information:
adb shell dumpsys bluetooth_manager
-
Check Battery Stats:
adb shell dumpsys batterystats
dumpstate
collects system logs and diagnostic data. You can use it to retrieve detailed information about the device state.
- Dump General Device Information:
adb shell dumpstate -v
Activity Manager (am
) commands allow you to control various aspects of Android apps, such as launching activities, broadcasting intents, and more.
-
Open Device Settings:
am start -n com.android.settings/.Settings
-
Factory Reset Device:
am broadcast -a android.intent.action.MASTER_CLEAR
Here are some commands to retrieve the IMEI (International Mobile Equipment Identity) of your device:
- Print IMEI:
service call iphonesubinfo 1 | cut -d "'" -f2
These commands include a variety of useful operations such as sending SMS, waking apps, and more:
-
Send an SMS:
am broadcast -a com.whereismywifeserver.intent.TEST --es sms_body "Test message from ADB"
-
Simulate App Wake:
am set-inactive <package_name> false
Feel free to contribute! If you have any cool ADB commands or improvements, you're welcome to submit a pull request or open an issue. Let's build the ultimate ADB cheatsheet together!
This project is licensed under the MIT License – see the LICENSE file for details.
By organizing the content and adding helpful descriptions, the README.md
becomes more user-friendly and easier to navigate!