{"slug": "adb-useful-commands-list", "title": "Adb useful commands list", "summary": "The article provides a comprehensive list of useful Android Debug Bridge (ADB) commands for tasks such as device management, file transfer, app installation, and log analysis. It also introduces ADBugger, a desktop tool for macOS that wraps these commands in a user interface, displaying each executed command in a log section for transparency and learning. The tool is designed to simplify debugging, testing, and performance analysis of Android devices and emulators.", "body_md": "AdbCommands\n\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      \nLearn more about bidirectional Unicode characters\n\n \n    Show hidden characters\n\nHi All!\n\nI've recently launched a tool that wraps many of the commands here with a user interface. This desktop application is currently available for macOS. There's a roadmap outlining planned features for the near future.\n\nFeel free to request any features you'd like to see, and I'll prioritize them accordingly.\n\nOne of the most important aspects of this application is that every command executed behind the scenes is displayed in a special log section. This allows you to see exactly what’s happening and learn from it.\n\nHere's the link to the repository:  https://github.com/Pulimet/ADBugger\n\nApp Description:\n\nADBugger is a desktop tool designed for debugging and QA of Android devices and emulators. It simplifies testing, debugging, and performance analysis by offering device management, automated testing, log analysis, and remote control capabilities. This ensures smooth app performance across various setups.\n\n \n\n=============================\n\nadb help // List all comands\n\n== Adb Server\n\nadb kill-server\n\nadb start-server \n\n== Adb Reboot\n\nadb reboot\n\nadb reboot recovery \n\nadb reboot-bootloader\n\nadb root //restarts adb with root permissions\n\n== Shell\n\nadb shell    // Open or run commands in a terminal on the host Android device.\n\n== Devices\n\nadb usb\n\nadb devices   //show devices attached\n\nadb devices -l //devices (product/model)\n\nadb connect ip_address_of_device\n\n== Get device android version\n\nadb shell getprop ro.build.version.release \n\n== LogCat\n\nadb logcat\n\nadb logcat -c // clear // The parameter -c will clear the current logs on the device.\n\nadb logcat -d > [path_to_file] // Save the logcat output to a file on the local system.\n\nadb bugreport > [path_to_file] // Will dump the whole device information like dumpstate, dumpsys and logcat output.\n\n== Files\n\nadb push [source] [destination]    // Copy files from your computer to your phone.\n\nadb pull [device file location] [local file location] // Copy files from your phone to your computer.\n\n== App install\n\nadb -e install path/to/app.apk\n\n-d                        - directs command to the only connected USB device...\n\n-e                        - directs command to the only running emulator...\n\n-s <serial number>        ...\n\n-p <product name or path> ...\n\nThe flag you decide to use has to come before the actual adb command:\n\nadb devices | tail -n +2 | cut -sf 1 | xargs -IX adb -s X install -r com.myAppPackage // Install the given app on all connected devices.\n\n== Uninstalling app from device\n\nadb uninstall com.myAppPackage\n\nadb uninstall <app .apk name>\n\nadb uninstall -k <app .apk name> -> \"Uninstall .apk withour deleting data\"\n\nadb shell pm uninstall com.example.MyApp\n\nadb shell pm clear [package] // Deletes all data associated with a package.\n\nadb devices | tail -n +2 | cut -sf 1 | xargs -IX adb -s X uninstall com.myAppPackage //Uninstall the given app from all connected devices\n\n== Update app\n\nadb install -r yourApp.apk  //  -r means re-install the app and keep its data on the device.\n\nadb install –k <.apk file path on computer> \n\n== Home button\n\nadb shell am start -W -c android.intent.category.HOME -a android.intent.action.MAIN\n\n== Activity Manager\n\nadb shell am start -a android.intent.action.VIEW\n\nadb shell am broadcast -a 'my_action'\n\nadb shell am start -a android.intent.action.CALL -d tel:+972527300294 // Make a call\n\n// Open send sms screen with phone number and the message:\n\nadb shell am start -a android.intent.action.SENDTO -d sms:+972527300294   --es  sms_body \"Test --ez exit_on_sent false\n\n// Reset permissions\n\nadb shell pm reset-permissions -p your.app.package \n\nadb shell pm grant [packageName] [ Permission]  // Grant a permission to an app. \n\nadb shell pm revoke [packageName] [ Permission]   // Revoke a permission from an app.\n\n// Emulate device\n\nadb shell wm size 2048x1536\n\nadb shell wm density 288\n\n// And reset to default\n\nadb shell wm size reset\n\nadb shell wm density reset\n\n== Print text\n\nadb shell input text 'Wow, it so cool feature'\n\n== Screenshot\n\nadb shell screencap -p /sdcard/screenshot.png\n\n$ adb shell\n\nshell@ $ screencap /sdcard/screen.png\n\nshell@ $ exit\n\n$ adb pull /sdcard/screen.png\n\n---\n\nadb shell screenrecord /sdcard/NotAbleToLogin.mp4\n\n$ adb shell\n\nshell@ $ screenrecord --verbose /sdcard/demo.mp4\n\n(press Control + C to stop)\n\nshell@ $ exit\n\n$ adb pull /sdcard/demo.mp4\n\n== Key event\n\nadb shell input keyevent 3 // Home btn\n\nadb shell input keyevent 4 // Back btn\n\nadb shell input keyevent 5 // Call\n\nadb shell input keyevent 6 // End call\n\nadb shell input keyevent 26  // Turn Android device ON and OFF. It will toggle device to on/off status.\n\nadb shell input keyevent 27 // Camera\n\nadb shell input keyevent 64 // Open browser\n\nadb shell input keyevent 66 // Enter\n\nadb shell input keyevent 67 // Delete (backspace)\n\nadb shell input keyevent 207 // Contacts\n\nadb shell input keyevent 220 / 221 // Brightness down/up\n\nadb shell input keyevent 277 / 278 /279 // Cut/Copy/Paste\n\n0 -->  \"KEYCODE_0\" \n\n1 -->  \"KEYCODE_SOFT_LEFT\" \n\n2 -->  \"KEYCODE_SOFT_RIGHT\" \n\n3 -->  \"KEYCODE_HOME\" \n\n4 -->  \"KEYCODE_BACK\" \n\n5 -->  \"KEYCODE_CALL\" \n\n6 -->  \"KEYCODE_ENDCALL\" \n\n7 -->  \"KEYCODE_0\" \n\n8 -->  \"KEYCODE_1\" \n\n9 -->  \"KEYCODE_2\" \n\n10 -->  \"KEYCODE_3\" \n\n11 -->  \"KEYCODE_4\" \n\n12 -->  \"KEYCODE_5\" \n\n13 -->  \"KEYCODE_6\" \n\n14 -->  \"KEYCODE_7\" \n\n15 -->  \"KEYCODE_8\" \n\n16 -->  \"KEYCODE_9\" \n\n17 -->  \"KEYCODE_STAR\" \n\n18 -->  \"KEYCODE_POUND\" \n\n19 -->  \"KEYCODE_DPAD_UP\" \n\n20 -->  \"KEYCODE_DPAD_DOWN\" \n\n21 -->  \"KEYCODE_DPAD_LEFT\" \n\n22 -->  \"KEYCODE_DPAD_RIGHT\" \n\n23 -->  \"KEYCODE_DPAD_CENTER\" \n\n24 -->  \"KEYCODE_VOLUME_UP\" \n\n25 -->  \"KEYCODE_VOLUME_DOWN\" \n\n26 -->  \"KEYCODE_POWER\" \n\n27 -->  \"KEYCODE_CAMERA\" \n\n28 -->  \"KEYCODE_CLEAR\" \n\n29 -->  \"KEYCODE_A\" \n\n30 -->  \"KEYCODE_B\" \n\n31 -->  \"KEYCODE_C\" \n\n32 -->  \"KEYCODE_D\" \n\n33 -->  \"KEYCODE_E\" \n\n34 -->  \"KEYCODE_F\" \n\n35 -->  \"KEYCODE_G\" \n\n36 -->  \"KEYCODE_H\" \n\n37 -->  \"KEYCODE_I\" \n\n38 -->  \"KEYCODE_J\" \n\n39 -->  \"KEYCODE_K\" \n\n40 -->  \"KEYCODE_L\" \n\n41 -->  \"KEYCODE_M\" \n\n42 -->  \"KEYCODE_N\" \n\n43 -->  \"KEYCODE_O\" \n\n44 -->  \"KEYCODE_P\" \n\n45 -->  \"KEYCODE_Q\" \n\n46 -->  \"KEYCODE_R\" \n\n47 -->  \"KEYCODE_S\" \n\n48 -->  \"KEYCODE_T\" \n\n49 -->  \"KEYCODE_U\" \n\n50 -->  \"KEYCODE_V\" \n\n51 -->  \"KEYCODE_W\" \n\n52 -->  \"KEYCODE_X\" \n\n53 -->  \"KEYCODE_Y\" \n\n54 -->  \"KEYCODE_Z\" \n\n55 -->  \"KEYCODE_COMMA\" \n\n56 -->  \"KEYCODE_PERIOD\" \n\n57 -->  \"KEYCODE_ALT_LEFT\" \n\n58 -->  \"KEYCODE_ALT_RIGHT\" \n\n59 -->  \"KEYCODE_SHIFT_LEFT\" \n\n60 -->  \"KEYCODE_SHIFT_RIGHT\" \n\n61 -->  \"KEYCODE_TAB\" \n\n62 -->  \"KEYCODE_SPACE\" \n\n63 -->  \"KEYCODE_SYM\" \n\n64 -->  \"KEYCODE_EXPLORER\" \n\n65 -->  \"KEYCODE_ENVELOPE\" \n\n66 -->  \"KEYCODE_ENTER\" \n\n67 -->  \"KEYCODE_DEL\" \n\n68 -->  \"KEYCODE_GRAVE\" \n\n69 -->  \"KEYCODE_MINUS\" \n\n70 -->  \"KEYCODE_EQUALS\" \n\n71 -->  \"KEYCODE_LEFT_BRACKET\" \n\n72 -->  \"KEYCODE_RIGHT_BRACKET\" \n\n73 -->  \"KEYCODE_BACKSLASH\" \n\n74 -->  \"KEYCODE_SEMICOLON\" \n\n75 -->  \"KEYCODE_APOSTROPHE\" \n\n76 -->  \"KEYCODE_SLASH\" \n\n77 -->  \"KEYCODE_AT\" \n\n78 -->  \"KEYCODE_NUM\" \n\n79 -->  \"KEYCODE_HEADSETHOOK\" \n\n80 -->  \"KEYCODE_FOCUS\" \n\n81 -->  \"KEYCODE_PLUS\" \n\n82 -->  \"KEYCODE_MENU\" \n\n83 -->  \"KEYCODE_NOTIFICATION\" \n\n84 -->  \"KEYCODE_SEARCH\" \n\n85 -->  \"KEYCODE_MEDIA_PLAY_PAUSE\"\n\n86 -->  \"KEYCODE_MEDIA_STOP\"\n\n87 -->  \"KEYCODE_MEDIA_NEXT\"\n\n88 -->  \"KEYCODE_MEDIA_PREVIOUS\"\n\n89 -->  \"KEYCODE_MEDIA_REWIND\"\n\n90 -->  \"KEYCODE_MEDIA_FAST_FORWARD\"\n\n91 -->  \"KEYCODE_MUTE\"\n\n92 -->  \"KEYCODE_PAGE_UP\"\n\n93 -->  \"KEYCODE_PAGE_DOWN\"\n\n94 -->  \"KEYCODE_PICTSYMBOLS\"\n\n...\n\n122 -->  \"KEYCODE_MOVE_HOME\"\n\n123 -->  \"KEYCODE_MOVE_END\"\n\n// https://developer.android.com/reference/android/view/KeyEvent.html\n\n== ShPref\n\n# replace org.example.app with your application id\n\n# Add a value to default shared preferences.\n\nadb shell 'am broadcast -a org.example.app.sp.PUT --es key key_name --es value \"hello world!\"'\n\n# Remove a value to default shared preferences.\n\nadb shell 'am broadcast -a org.example.app.sp.REMOVE --es key key_name'\n\n# Clear all default shared preferences.\n\nadb shell 'am broadcast -a org.example.app.sp.CLEAR --es key key_name'\n\n# It's also possible to specify shared preferences file.\n\nadb shell 'am broadcast -a org.example.app.sp.PUT --es name Game --es key level --ei value 10'\n\n# Data types\n\nadb shell 'am broadcast -a org.example.app.sp.PUT --es key string --es value \"hello world!\"'\n\nadb shell 'am broadcast -a org.example.app.sp.PUT --es key boolean --ez value true'\n\nadb shell 'am broadcast -a org.example.app.sp.PUT --es key float --ef value 3.14159'\n\nadb shell 'am broadcast -a org.example.app.sp.PUT --es key int --ei value 2015'\n\nadb shell 'am broadcast -a org.example.app.sp.PUT --es key long --el value 9223372036854775807'\n\n# Restart application process after making changes\n\nadb shell 'am broadcast -a org.example.app.sp.CLEAR --ez restart true'\n\n== Monkey\n\nadb shell monkey -p com.myAppPackage -v 10000 -s 100 // monkey tool is generating 10.000 random events on the real device\n\n== Paths\n\n/data/data/<package>/databases (app databases)\n\n/data/data/<package>/shared_prefs/ (shared preferences)\n\n/data/app (apk installed by user)\n\n/system/app (pre-installed APK files)\n\n/mmt/asec (encrypted apps) (App2SD)\n\n/mmt/emmc (internal SD Card)\n\n/mmt/adcard (external/Internal SD Card)\n\n/mmt/adcard/external_sd (external SD Card)\n\nadb shell ls (list directory contents)\n\nadb shell ls -s (print size of each file)\n\nadb shell ls -R (list subdirectories recursively)\n\n== Device onformation\n\nadb get-statе (print device state)\n\nadb get-serialno (get the serial number)\n\nadb shell dumpsys iphonesybinfo (get the IMEI)\n\nadb shell netstat (list TCP connectivity)\n\nadb shell pwd (print current working directory)\n\nadb shell dumpsys battery (battery status)\n\nadb shell pm list features (list phone features)\n\nadb shell service list (list all services)\n\nadb shell dumpsys activity <package>/<activity> (activity info)\n\nadb shell ps (print process status)\n\nadb shell wm size (displays the current screen resolution)\n\ndumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp' (print current app's opened activity)\n\n== Package info\n\nadb shell list packages (list package names)\n\nadb shell list packages -r (list package name + path to apks)\n\nadb shell list packages -3 (list third party package names)\n\nadb shell list packages -s (list only system packages)\n\nadb shell list packages -u (list package names + uninstalled)\n\nadb shell dumpsys package packages (list info on all apps)\n\nadb shell dump <name> (list info on one package)\n\nadb shell path <package> (path to the apk file)\n\n==Configure Settings Commands\n\nadb shell dumpsys battery set level <n> (change the level from 0 to 100)\n\nadb shell dumpsys battery set status<n> (change the level to unknown, charging, discharging, not charging or full)\n\nadb shell dumpsys battery reset (reset the battery)\n\nadb shell dumpsys battery set usb <n> (change the status of USB connection. ON or OFF)\n\nadb shell wm size WxH (sets the resolution to WxH)\n\n== Device Related Commands\n\nadb reboot-recovery (reboot device into recovery mode)\n\nadb reboot fastboot (reboot device into recovery mode)\n\nadb shell screencap -p \"/path/to/screenshot.png\" (capture screenshot)\n\nadb shell screenrecord \"/path/to/record.mp4\" (record device screen)\n\nadb backup -apk -all -f backup.ab (backup settings and apps)\n\nadb backup -apk -shared -all -f backup.ab (backup settings, apps and shared storage)\n\nadb backup -apk -nosystem -all -f backup.ab (backup only non-system apps)\n\nadb restore backup.ab (restore a previous backup)\n\nadb shell am start|startservice|broadcast <INTENT>[<COMPONENT>]\n\n-a <ACTION> e.g. android.intent.action.VIEW\n\n-c <CATEGORY> e.g. android.intent.category.LAUNCHER (start activity intent)\n\nadb shell am start -a android.intent.action.VIEW -d URL (open URL)\n\nadb shell am start -t image/* -a android.intent.a", "url": "https://wpnews.pro/news/adb-useful-commands-list", "canonical_source": "https://gist.github.com/Pulimet/5013acf2cd5b28e55036c82c91bd56d8", "published_at": "2017-09-11 10:36:27+00:00", "updated_at": "2026-05-23 19:05:49.989158+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["ADBugger", "Pulimet"], "alternates": {"html": "https://wpnews.pro/news/adb-useful-commands-list", "markdown": "https://wpnews.pro/news/adb-useful-commands-list.md", "text": "https://wpnews.pro/news/adb-useful-commands-list.txt", "jsonld": "https://wpnews.pro/news/adb-useful-commands-list.jsonld"}}