Skip to content

Nobitaspeaks2711/ADB_Cheetsheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

ADB Cheatsheet

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!

Table of Contents

  1. Introduction
  2. Getting Started
  3. Basic Commands
  4. ADB Package Manager
  5. Logcat
  6. Dumpsys
  7. Dumpstate
  8. AM (Activity Manager)
  9. IMEI Commands
  10. Miscellaneous
  11. Contributing
  12. License

Introduction

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.

Getting Started

To get started with ADB, make sure that:

  1. ADB is installed on your system. You can install it as part of the Android SDK or via other package managers.
  2. USB Debugging is enabled on your Android device under Developer Options.

Start and Stop ADB Server

adb start-server  # Start ADB server
adb stop-server   # Stop ADB server
adb kill-server   # Kill ADB server

Connect to a Device via Wi-Fi

adb tcpip <port>
adb connect <device_ip>

List Connected Devices

adb devices

Basic Commands

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

ADB Package Manager

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

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

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

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

AM (Activity Manager)

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

IMEI Commands

Here are some commands to retrieve the IMEI (International Mobile Equipment Identity) of your device:

  • Print IMEI:
    service call iphonesubinfo 1 | cut -d "'" -f2

Miscellaneous

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

Contributing

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!


License

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!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published